Exception 异常插件utf8_encode在php8.2被弃用

ziyoren

问题描述

Exception 异常插件

utf8_encode()
8.2.0 弃用此函数。
@Tinywan

程序代码

    private static function _sign(string $url, string $secret): string
    {
        [$s1, $s2] = explode(' ', microtime());
        $timestamp = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
        $data = $timestamp . "\n" . $secret;
        $signStr = base64_encode(hash_hmac('sha256', $data, $secret, true));
        $signStr = utf8_encode(urlencode($signStr)); 
        return $url . "&timestamp=$timestamp&sign=$signStr";
    }

报错信息

ErrorException: Function utf8_encode() is deprecated in
/*****/vendor/tinywan/exception-handler/src/Event/DingTalkRobotEvent.php:62

截图报错信息里报错文件相关代码

截图

操作系统及workerman/webman等框架组件具体版本

php8.2.4

654 0 0
0个回答

年代过于久远,无法发表回答
×
🔝