加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

解决Deprecated:Methodswiththesamenameastheirclasswillnotbeconstructorsin报错方案

(2023-06-02 11:39:57)
标签:

php

分类: WEB开发

 

解决Deprecated: Methods with the same name as their class will not be constructors in报错方案

 


 


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

 

报错

解决Deprecated:Methodswiththesamenameastheirclasswillnotbeconstructorsin报错方案


( ! ) 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

 

解决方案

通过查看PHP官网的文档发现,php7.0之后将不再支持与类名相同的构造方法,构造方法统一使用 __construct()

 

查找代码:D:\wamp\www\kindeditor\JSON.php on line 795

 

原文件

    class Services_JSON_Error

    {

        function Services_JSON_Error($message = 'unknown error', $code = null,

                                     $mode = null, $options = null, $userinfo = null)

        {

 

        }

    }

改为

   class Services_JSON_Error

    {

        function __construct($message = 'unknown error', $code = null,

                                     $mode = null, $options = null, $userinfo = null)

        {

 

        }

    }

 

 

function Services_JSON_Error 改为 function __construct

————————————————

原文链接:https://blog.csdn.net/guo_qiangqiang/article/details/124929721

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有