实际上,我有一个wordpress插件,它用作woocommerce的网关,在将服务器上的php 7.1更新为php 7.2之前运行良好。 你们知道php7.2不支持mcrypt_encode和mcrypt_decode,建议改用openssl_encrypt ...加密的旧代码如下: 公共函数crypto($ string =“”)
{
global $KEY,$IV;
$key1 = base64_decode($this->KEY);
$iv1 = base64_decode($this->IV);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $this->addpadding($string), MCRYPT_MODE_CBC, $iv1));
}
public function decrypt($string ="")
{
global $KEY,$IV;
$key = base64_decode($this->KEY);
$iv = base64_decode($this->IV);
$string = base64_decode($string);
return $this->strippadding(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv));
}
我曾尝试将它们转换为openssl作为文档,但我想有些东西我不知道或我不了解(很不幸)...
你们会帮助我将上面的代码转换为openssl版本吗??
预先感谢