以下是ECshop
安装在PHP5.5.12
环境下出现的报错,记录一下。
1.检查安装环境配置的时候报错:
Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\X\www\ecshop\install\includes\lib_installer.php on line 31
原因:找到install/includes/lib_installer.php
中的第31行 return cls_image::gd_version();
然后在找到includes/cls_image.php
中的678
行,发现gd_version()
方法未声明静态static
。
解决:在includes/cls_image.php
中的678
行function gd_version()
改成static function gd_version()
。
2.检测环境的时候提示:是否支持JPEG
是不支持的。
解决:将install/includes/lib_installer.php
中第98
行JPG
修改成JPEG
。
$jpeg_enabled = ($gd_info['JPEG Support'] === true) ? $_LANG['support'] : $_LANG['not_support'];
3.1安装完登录后台报错:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\phpDemo\ecshop\includes\cls_template.php on line 300
原因:在PHP5.5
以上版本中preg_replace()
函数中用到的修饰符 /e
在 PHP5.5.x
中已经被弃用了。
解决:打开文件includes/cls_template.php
将300
行
return preg_replace("/{([^\}\{\n]*)}/e", "\this->select('\\1');",source);
//修改为:
return preg_replace_callback("/{([^\}\{\n]*)}/", function(r) { returnthis->select(r[1]); },source);
类似preg_replace()
函数中用到的修饰符 /e
提示替换 preg_replace_callback()
的还有几处:
3.2文件includes/cls_template.php
的493
行:
$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
//修改为:
$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($r) {return stripslashes(trim($r[1],'\''));}, var_export($t, true)) . ";\n";
3.3文件includes/cls_template.php
的553
行:
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
//修改为:
$val = preg_replace_callback("/\[([^\[\]]*)\]/", function($r) {return '.'.str_replace('$','$',$r[1]);}, $val);
3.4文件includes/cls_template.php
的1069
行:
$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
// 修改为:
$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
$source = preg_replace_callback($pattern, function($r){return '{include file='.strtolower($r[1]). '}';}, $source);
4:错误信息:
Strict Standards: Only variables should be passed by reference in E:\web\shopex\includes\cls_template.php on line 422
原因:PHP5.3
以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode
就得移出来重新赋值。
解决:将includes\cls_template.php
文件422
行
$tag_sel = array_shift(explode(' ', $tag));
// 修改为:
$tag_arr = explode(' ', $tag);
$tag_sel = array_shift($tag_arr);
5.后台错误信息:
Strict standards: mktime(): You should be using the time() function instead in E:\phpDemo\ecshop\admin\sms_url.php on line 31
打开admin\sms_url.php
文件第31
行:
打开admin\shop_config.php
第332
行:
$auth = mktime();
// 修改为:
$auth = time();
原文链接:https://beltxman.com/1439.html,若无特殊说明本站内容为 行星带 原创,未经同意禁止转载。
includes/cls_template.php on line 553
出现这种状况!
怎么改
看文章中3.3就是说这个的
很详细,你在做ECSHOP?
没有,公司项目上用,我只负责打杂。