Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Model has a deprecated constructor in /data/web/mdz-guanwang/include/model.class.php on line 12
查阅资料,发现php7.0之后将不再支持与类名相同的构造方法,构造方法统一使用 __construct()。
查找代码:include/model.class.php 第12行
class Model
{
var $dsql;
var $db;
// 析构函数
function Model()
{
global $dsql;
if ($GLOBALS['cfg_mysql_type'] == 'mysqli')
{
$this->dsql = $this->db = isset($dsql)? $dsql : new DedeSqli(FALSE);
} else {
$this->dsql = $this->db = isset($dsql)? $dsql : new DedeSql(FALSE);
}
}
修改成
class Model
{
var $dsql;
var $db;
// 析构函数
function __construct()
{
global $dsql;
if ($GLOBALS['cfg_mysql_type'] == 'mysqli')
{
$this->dsql = $this->db = isset($dsql)? $dsql : new DedeSqli(FALSE);
} else {
$this->dsql = $this->db = isset($dsql)? $dsql : new DedeSql(FALSE);
}
}

查阅资料得知,PHP7.0之后不再支持与类名相同的构造方法,构造方法需统一使用 __construct(),还指出要查找 include/model.class.php 文件第12行并进行修改。
1万+

被折叠的 条评论
为什么被折叠?



