Rumah >pembangunan bahagian belakang >tutorial php >php 加密解密
汉字加密 解密,为了解决传输时,汉字符会丢失的问题
<code><span>$urlstr</span> = urlencode(<span>"我是codekissyoung"</span>); <span>echo</span> urldecode(<span>$urlstr</span>);</code>
不可逆加密 md5散列值,sha1 散列值
<code><span>echo</span> md5(<span>"hehexiix23"</span>); <span>echo</span> crypt(<span>$some_string</span>,<span>'keyvalue'</span>); <span>$str</span> = <span>'apple'</span>; <span>if</span> (sha1(<span>$str</span>) === <span>'d0be2dc421be4fcd0172e5afceea3970e2f3d940'</span>) { <span>echo</span><span>"Would you like a green or red apple?"</span>; }</code>
可逆加密
<code>base64_encode(<span>$string</span>); base64_decode(<span>$string</span>); convert_uudecode(<span>$str</span>); convert_uuencode(<span>$str</span>);</code>
版权声明:知识取之于民,用之于民!欢迎转载,转载请开头附上本文链接,不定期更新文章!
以上就介绍了php 加密解密,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。