//加密
function encrypt($str, $key) {
$data = openssl_encrypt($str, 'des-ede3', $key, OPENSSL_RAW_DATA);
$data = base64_encode($data);
return $data;
}
echo encrypt('test', '1234567890'); //输出:gG4HWgRHtKc=
//解密
$str = 'gG4HWgRHtKc=';
echo openssl_decrypt(base64_decode($str), 'des-ede3', '1234567890', OPENSSL_RAW_DATA); //输出:test
标签:3des,encrypt,加解密,php7.2,echo,str,data From: https://www.cnblogs.com/yangyixin/p/17469753.html