在codeigniter加密时避免使用特定的字符? [英] Avoid specific characters while encrypting in codeigniter?
问题描述
我需要通过URL传递一些加密的值。有没有办法避免一些字符,如斜线(/)在我们在加密后得到的值?因为在codeigniter中,字符如slash用于分隔URL中的参数。请注意,我不希望任何建议不传递URL中的加密字符串)。
I need to pass some encrypted value through URL. Is there any way to avoid some characters such as slash (/) in the value we are getting after encryption? Because in codeigniter, character such as slash is used for separating parameters in the URL. Please note that i don't want any suggestion to don't pass the encrypted string in URL :)
推荐答案
不是加密(这意味着安全),而是编码。实际上,您的选项基本上是:
What you want is not an encryption (which implies security) but an encoding. In practice, your options are basically:
- urlencode (如果您希望字符串稍微清晰。
- base64 (如果您不想让字符串清晰可见,请使用此字符串)想要节省字符串中的空格)
- 十六进制(如果您不希望字符串清晰易读, )
- urlencode (Use this if you want the string to be somewhat legible. This also will give you a shorter string than the other two options)
- base64 (use this if you don't want the string to be legible and also want to conserve space in your string)
- hex (use this if you don't want the string to be legible and you don't care about string length)
我不会选择十六进制。决定是否要让字符串清晰易读,并选择其中一个。
I wouldn't choose hex. Decide whether you want the string to be legible and pick one of the two first.
这篇关于在codeigniter加密时避免使用特定的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!