Laravel加密和解密

文章描述:

Laravel使用Crypt加密和解密

 

use Illuminate\Support\Facades\Crypt;

加密

$pass = '123456';
echo Crypt::encryptString($pass);

解密

$string  = 'eyJpdiI6IkpHSEtoWEE2Z3d1RURsTlp4MjBkbVE9PSIsInZhbHVlIjoiSmlsRGlOT1hHV2I4blFRTWRmWmQzQT09IiwibWFjIjoiYTZmYWVhYWY4YmNiN2JkOGRhZmI5MWFmY2Q0NTJkZDZlMGI4ZmVkN2Q5M2RiZTg1ODM1MDZhNTU5NTI4MjU3NyIsInRhZyI6IiJ9';
echo Crypt::decryptString($string);

 

发布时间:2023/03/27

发表评论