当前位置:首页 > PHP教程 >

Deprecated: Methods with the same name as their class will not be constructors

发布时间:2024-01-07 12:34:18 作者:佚名 阅读:(69)

今天把服务器上的PHP版本从5.6.3升级到php7.1.3,但是打开网站提示Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;接下来云梦编程为大家介绍解决方案,有需要的小伙伴可以参考一下:

1、错误原因:

    由于PHP7开始P不再支持与类名相同的构造方法,构造方法统一使用 __construct(),导致网站在PHP5.6版本下开发的网站不能正常运行。

2、解决方法:

captcha_width = isset($captcha_width) && $captcha_width > 0 ? $captcha_width : $this->captcha_width;
        $this->captcha_height = isset($captcha_height) && $captcha_height > 0 ? $captcha_height : $this->captcha_height;
    }
}

更改为:

captcha_width = isset($captcha_width) && $captcha_width > 0 ? $captcha_width : $this->captcha_width;
        $this->captcha_height = isset($captcha_height) && $captcha_height > 0 ? $captcha_height : $this->captcha_height;
    }
}

以上就是云梦编程为大家介绍的关于Deprecated: Methods with the same name as their class will not be constructors错误的解决方法,了解更多相关文章请关注云梦编程网!

© 2023 - 云梦编程网 版权所有 鲁ICP备2021017318号-4