当前位置:网站首页>Resolved: methods with the same name as their class will not be constructors in

Resolved: methods with the same name as their class will not be constructors in

2022-06-24 10:18:00 Wandering in memory of Yu Fei

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

Report errors

 Insert picture description here

( ! ) Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Services_JSON_Error has a deprecated constructor in D:\wamp\www\kindeditor\JSON.php on line 795

Solution

By looking at PHP Document discovery on the official website ,php7.0 The constructor with the same class name will no longer be supported , The construction method is used uniformly __construct().

Look for code :D:\wamp\www\kindeditor\JSON.php on line The first 795 That's ok

The original document
 Insert picture description here

    class Services_JSON_Error
    {
    
        function Services_JSON_Error($message = 'unknown error', $code = null,
                                     $mode = null, $options = null, $userinfo = null)
        {
    

        }
    }

Change it to

    class Services_JSON_Error
    {
    
        function __construct($message = 'unknown error', $code = null,
                                     $mode = null, $options = null, $userinfo = null)
        {
    

        }
    }

 Insert picture description here

take function Services_JSON_Error Change it to function __construct

原网站

版权声明
本文为[Wandering in memory of Yu Fei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240914529638.html