php 加密解密
php 加密解密
<?php function encryptWithOpenssl($data,$key,$iv){ return base64_encode(openssl_encrypt($data,"AES-128-CBC",$key,OPENSSL_RAW_DATA,$iv)); } public function tests1(){ //2r/4AGxjLgAKVaUkl1pSsA== // $res = $this->encryptWithOpenssl('password1', '26627hshs','hewa2020Yes54N21'); $RES = $this->decryptWithOpenssl('9YlkklI5BYi53VhiWJ5LJw==','26627hshs','hewa2020Yes54N21'); dd($RES); } function decryptWithOpenssl($data,$key,$iv){ return openssl_decrypt(base64_decode($data),"AES-128-CBC",$key,OPENSSL_RAW_DATA,$iv); }