Home > Article > Backend Development > PHP encryption and decryption function code implementation example
This article will take everyone to learn how to use PHP to implement encryption and decryption. The code has certain reference value, and friends in need can take a look.
------key:aaa----------
'; echo $x = passport_encrypt($str,'aaa'); //值会变,其中一个如下 //AOdS7lWlU+IM+1fnALBV5QOOV7dchQfEX+MCwgf2U3BXeQcnVuNavgPAA+hbmlLJAWEHIVRnD7hYvgf/U+lS4gCKUrdVvVO3 echo '
-----------------------
'; echo passport_decrypt($x,'aaa'); echo '
'; echo '
------key:bbb----------
'; echo $y = passport_encrypt($str,'bbb'); //值会变,其中一个如下 //Ae0F5gD1C+oB9wC/DOZZ6AeKU7MCjleWUbEAmFGuAi4JLF8gUeFW4lKQUrYBmlrAA2MHIVcxBrMFv1PzXOha5QGABb8A7Qu/ echo '
-----------------------
'; echo passport_decrypt($y,'bbb'); ?>
Related tutorials: PHP video tutorial
The above is the detailed content of PHP encryption and decryption function code implementation example. For more information, please follow other related articles on the PHP Chinese website!