ecshop在PHP 5.4以上版本后台数据备份错误
Strict Standards: Redefining already defined constructor for class cls_sql_dump in /home/webroot/mall/admin/includes/cls_sql_dump.php on line 90 Strict Standards: Non-static method cls_sql_dump::get_random_name() should not be called statically in /home/webroot/mall/admin/database.php on line 64
既然这样,那我们就好解决了,找到admin\includes\cls_sql_dump.php 478行
function get_random_name()
{
$str = date('Ymd');
for ($i = 0; $i < 6; $i++)
{
$str .= chr(mt_rand(97, 122));
}
return $str;
}
在前面添加上 static
static function get_random_name()
{
$str = date('Ymd');
for ($i = 0; $i < 6; $i++)
{
$str .= chr(mt_rand(97, 122));
}
return $str;
}
ok,解决
Strict Standards: Redefining already defined constructor for class cls_sql_dump in /home/websys/www/mallnew/sm/includes/cls_sql_dump.php on line 90
1)、错误原因:
PHP 类,有两种构造函数,一种是跟类同名的函数,一种是 __c**truct()。从PHP5.4开始,对这两个函数出现的顺序做了最严格的定义,必须是 __c**truct() 在前,同名函数在后
2)、
解决方法:
调换一下两个函数的前后位置即可。
以 includes/modules/payment/alipay.php 为例:
将下面这两个函数的位置互换一下就OK了,__c**truct()在前,alipay()在后
-
function alipay() {
-
}
-
-
function __c**truct()
-
{
-
$this->alipay();
-
}