PHP报错"Deprecated: Methods with the same name ...
- A
昨天在帮人修BUG的时候发现提示了个致命报错,我模拟一下案例:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;Pjax has a deprecated constructor in /www/wwwroot/www.recho.cn/include/pjax.class.php on line 5
通过查看PHP官网的文档发现,php7.0之后将不再支持与类名相同的构造方法,构造方法统一使用 __construct()。
查找代码:include/pjax.class.php 第5行
<?php
class Pjax
{
// 构造函数
function Pjax()
{
if (!empty($问题) && !empty($钱))
{
$问题 = '解决';
} else {
$问题 = '无解';
}
}
}
修改成
<?php
class Pjax
{
// 构造函数
function __construct()
{
if (!empty($问题) && !empty($钱))
{
$问题 = '解决';
} else {
$问题 = '无解';
}
}
}
版权声明:若无特殊注明,本文为《傲世》原创,转载请保留文章出处。
本文链接:https://www.recho.cn/153.html
如您对本文章内容有所疑问、反馈或补充,欢迎通过邮箱:admin@h2fast.cn 联系我们!
正文到此结束







