问题
- 请求的account参数中出现
\ufeff
{"sign":"9996d93b6544b57ec970b9c694256e97","time":"1743453382","\ufeffaccount":"DA9AABC72366EURBUV","password":"","udid":"b26e827734f6ea5af669943212ab596b"}
解决方案:
-
打开
Ue/tools/encryption/aes/aes.php -
在
decode()方法中,找到解密后的代码位置 -
添加以下代码:
$strdecode = preg_replace('/\x{FEFF}/u', '', $strdecode); // 移除所有BOM字符
或更精确的:
$strdecode = str_replace("\xEF\xBB\xBF", '', $strdecode); // 移除UTF-8 BOM
最终代码示例
/**
* 解密
* @param string $data 密文(已base64加密的密文)
* @return string 明文
*/
public function decode($data){
$strdecode = openssl_decrypt(hex2bin($data), 'AES-128-CBC', $this->config['key'], OPENSSL_RAW_DATA, $this->config['iv']);
$strdecode = str_replace("\xEF\xBB\xBF", '', $strdecode); // 移除UTF-8 BOM
return $strdecode;
}
说明
-
这行代码会移除字符串中所有BOM字符
-
修改后保存文件即可
-
无需其他额外操作




没有回复内容