thinkphp5 微信解密 简洁版
//微信解密
public static function WxJm($appid, $sessionKey, $encryptedData, $iv)
{
if (strlen($sessionKey) != 24) {
self::ApiRes(-41001,'JM');
}
$aesKey=base64_decode($sessionKey);
if (strlen($iv) != 24) {
self::ApiRes(-41002,'JM');
}
$aesIV=base64_decode($iv);
$aesCipher=base64_decode($encryptedData);
$result=openssl_decrypt( $aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
return $result;
}