PHP接口请求参数对策加密+

 <?php 
  //加密
    public function encrypt($data){
      $id =json_encode($data);
      $str =base64_encode($id);
      $str = openssl_encrypt($str, 'aes-128-cbc', \config('aes_passwd'), OPENSSL_ZERO_PADDING, \config('aes_iv'));
      return $str;
    }
    //解密
    public  function decrypt($str){
     var_dump(\config('aes_passwd'));var_dump(\config('aes_iv'));die;
     $str = openssl_decrypt($str, 'aes-128-cbc', \config('aes_passwd'), OPENSSL_ZERO_PADDING, \config('aes_iv'));
     $str = base64_decode($str);
     $str =json_decode(trim($str),true);
     return $str;
    }

  

posted on 2023-08-23 16:24  kevin_yang123  阅读(32)  评论(0编辑  收藏  举报