Home > Article > Backend Development > php encryption and decryption
Chinese character encryption and decryption, in order to solve the problem of Chinese characters being lost during transmission
<code><span>$urlstr</span> = urlencode(<span>"我是codekissyoung"</span>); <span>echo</span> urldecode(<span>$urlstr</span>);</code>
Irreversible encryption md5 hash value, sha1 hash value
<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>
Reversible encryption
<code>base64_encode(<span>$string</span>); base64_decode(<span>$string</span>); convert_uudecode(<span>$str</span>); convert_uuencode(<span>$str</span>);</code>
Copyright statement: Knowledge comes from the people, Use it for the people! Reprinting is welcome. Please attach a link to this article at the beginning. The article will be updated from time to time!
The above introduces PHP encryption and decryption, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.