PHP笔记更新个php版aes加密解密方法//20220805新增 /**加密 * @param $data * @return string * $key = "1234567887654321";//秘钥必须为:8/16/32位 * $iv = "1234567887654321"; */ if (!function_exists('aes_encrypt')) { function aes_e作者王明昌发布时间2023-09-10复制//20220805新增 /**加密 * @param $data * @return string * $key = "1234567887654321";//秘钥必须为:8/16/32位 * $iv = "1234567887654321"; */ if (!function_exists('aes_encrypt')) { function aes_encrypt($data,$key='1234567887654321',$iv='1234567887654321') { $base64_str = base64_encode(json_encode($data)); $encrypted = openssl_encrypt($base64_str, "aes-128-cbc", $key, OPENSSL_ZERO_PADDING, $iv); return base64_encode($encrypted); } } /**解密 * @param $data * @return mixed * $key = "1234567887654321";//秘钥必须为:8/16/32位 * $iv = "1234567887654321"; */ if (!function_exists('aes_decrypt')) { function aes_decrypt($data,$key='1234567887654321',$iv='1234567887654321') { $encrypted = base64_decode($data); $decrypted = openssl_decrypt($encrypted, 'aes-128-cbc', $key, OPENSSL_ZERO_PADDING, $iv); return json_decode(base64_decode($decrypted), true); } }
2022-09-05使用了又拍云cdn,出现50302008报错近期网站使用了又拍云的cdn,毕竟可以可以免费试用,很是很ok的但是也遇到了一些问题由于网站时使用了ssl ,今天网站就报错50302008{ "msg": "closed", "code": "50