1. 微信端需要四个参数:
session_key encryptedData iv appid (小程序的)
$session_key=$param["session_key"]; $iv=$param["iv"]; $encryptedData=$param["encryptedData"]; $openId=$param["openId"]; $appid=\config('appid'); if (strlen($session_key)!=24) { $this->error("session_key 非法"); } $aesKey=base64_decode($session_key); if (strlen($iv) != 24) { $this->error("IV错误"); } $aesIV=base64_decode($iv); $aesCipher=base64_decode($encryptedData); $result=openssl_decrypt( $aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV); $dataObj=json_decode( $result ); if( $dataObj == NULL ) { $this->error("aes 解密失败"); } if( $dataObj->watermark->appid != $appid) { $this->error("aes 解密失败"); } $data = $result; $tel = json_decode($data,true);
$tel 的里面就有手机号的
然后进行添加修改用户信息