private $cipher = "AES-256-CBC"; private $key = G_COOKIE_HASH_KEY; private $ivLen; public function __construct() { $this->key = hash('sha256', $this->key, true); $this->ivLen = openssl_cipher_iv_length($this->cipher); } public function encode($input) { $iv = openssl_random_pseudo_bytes($this->ivLen); $data = openssl_encrypt($input, $this->cipher, $this->key, OPENSSL_RAW_DATA, $iv); $data = base64_encode($iv . $data); return $data; } public function decode($input) { $input = base64_decode($input); $iv = substr($input, 0, $this->ivLen); $input = substr($input, $this->ivLen); $decrypted = openssl_decrypt($input, $this->cipher, $this->key, OPENSSL_RAW_DATA, $iv); return $decrypted; }2、php 7.2的count()函数只支持数组或对象的计算,传入字符串或数字会报warning错误,如果你用的是7.2,打开wecenter第一步就会报500错误,因为zend框架里有一个地方使用count计算了一个不是数组的变量。因此我们还要把它改掉: 打开/system/Zend/Db/Table/Abstract.php,找到1307行,
$keyValuesCount = count($keyValues);把它插入到1313行后面,改完之后是这样的
if (!is_array($keyValues)) { $keyValues = array($keyValues); } $keyValuesCount = count($keyValues);
这家伙很懒,还没有设置简介