您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程
ecshop适配PHP5.6的方法
千萍2025-01-17Ecshop商城教程已有人查阅
导读适配1:Strict standards: Non-static method cls_image::gd_version() should not be called statically in C:\wamp64\ \install\includes\lib_installer.php on line 31
适配1:
Strict standards: Non-static method cls_image::gd_version() should not be called statically in C:\wamp64\ \install\includes\lib_installer.php on line 31
找到include/cls_image.php中的678行,将function gd_version()改成static function gd_version()即可。
适配2:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp64\ \includes\cls_template.php on line 1071
原因:
preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。
如果你的PHP版本恰好是PHP5.5.X,那你的ECSHOP肯定就会报类似下面这样的错误:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in......
其实从刚才的错误提示信息中我们也能看出一二,它提示我们使用 preg_replace_callback 来代替 preg_replace。
解决方法:
使用记事本或其他PHP编辑软件(如:editplus)打开文件 includes/cls_template.php ,找到
注:如果你的ECSHOP中其他文件也报类似的 preg_replace错误,请参照上面方法解决之,解决思路和解决方法是一样的。
适配3:
Strict standards: Only variables should be passed by reference in C:\wamp64\ \includes\cls_template.php on line 422
原因:
我的PHP版本是5.6.25,PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode就得移出来重新赋值了
解决方法:
把
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp64\ \includes\cls_template.php on line 1072
解决方法:
找到includes/cls_template.php第1072行左右,
将
Strict Standards: Redefining already defined constructor for class alipay in /data/web/includes/modules/payment/alipay.PHP on line 85
解决方法:
找到alipay.php中的class alipay{……},
将
主要集中在 upload/includes/cls_template.php 文件中:
1:line 300 :
原语句:
Strict standards: Non-static method cls_image::gd_version() should not be called statically in C:\wamp64\ \install\includes\lib_installer.php on line 31
找到include/cls_image.php中的678行,将function gd_version()改成static function gd_version()即可。
适配2:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp64\ \includes\cls_template.php on line 1071
原因:
preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。
如果你的PHP版本恰好是PHP5.5.X,那你的ECSHOP肯定就会报类似下面这样的错误:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in......
其实从刚才的错误提示信息中我们也能看出一二,它提示我们使用 preg_replace_callback 来代替 preg_replace。
解决方法:
使用记事本或其他PHP编辑软件(如:editplus)打开文件 includes/cls_template.php ,找到
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
替换为
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
问题解决。注:如果你的ECSHOP中其他文件也报类似的 preg_replace错误,请参照上面方法解决之,解决思路和解决方法是一样的。
适配3:
Strict standards: Only variables should be passed by reference in C:\wamp64\ \includes\cls_template.php on line 422
原因:
我的PHP版本是5.6.25,PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,所以这段代码中的explode就得移出来重新赋值了
解决方法:
把
$tag_sel = array_shift(explode(' ', $tag));
替换为
$tagArr = explode(' ', $tag);
$tag_sel = array_shift($tagArr);
适配4:Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\wamp64\ \includes\cls_template.php on line 1072
解决方法:
找到includes/cls_template.php第1072行左右,
将
$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);
适配5:Strict Standards: Redefining already defined constructor for class alipay in /data/web/includes/modules/payment/alipay.PHP on line 85
解决方法:
找到alipay.php中的class alipay{……},
将
function __construct()
{
$this->alipay();
}
移到
function alipay()
{
}
之前。主要集中在 upload/includes/cls_template.php 文件中:
1:line 300 :
原语句:
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
修改为:
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source)
2:line 495:原语句:
$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
修改为:
$replacement = preg_replace_callback("/(\'\\$[^,]+)/" ,function($matcher){ return stripslashes(trim($matcher[1],'\'')); },var_export($t, true));$out = "<?php \n" . '$k = ' . $replacement . ";\n";
3:line 554:原语句:
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
修改为:
$val = preg_replace_callback("/\[([^\[\]]*)\]/is",function ($matcher) { return '.'.str_replace('$','\$',$matcher[1]); }, $val);
本文标签:
很赞哦! ()
上一篇:ecshop二次开发修改问答
相关教程
图文教程
ecshop2.7在php5.4以上版本报错的解决方法
是不是对较新版本的php适配ecshop很苦恼.最近我就遇到了这个事情,最终我花了一个小时的时间把这个问题解决了,特放出来,方便大家查阅。
ecshop商城自定义调用广告的实现方法
使用ecshop进行商城网站建设时,ecshop默认的很多功能对于我们个性化设计之后不太使用。今天我们主要是来分析如果自定义调用广告位:
ecshop实现退出登录不清空购物车的优化方法实例
ecshop退出登陆后会清空购物车里面的商品,大家都应该知道有这样的算是功能缺陷。网上类似的教程相当多,但都有问题,说句不好听的,算是引新手入!
ecshop选购中心默认只显示4个商品改成任意数量
ECSHOP选购中心,大多数站长都把这个隐藏了,但是也有的站长保留了这个功能。但是,“ECSHOP选购中心默认只显示4个商品”,如何解决呢?方法很简单:打
相关源码
-
帝国cms7.5游戏门户H5小游戏网站模板源码免费下载基于帝国CMS7.5开发的H5游戏门户模板,为在线游戏平台设计。支持PC端与移动端同步生成,打造完整的游戏娱乐体验平台。查看源码 -
(PC+WAP)货运物流快递仓储货架pbootcms网站模板下载本模板基于PbootCMS开发,为货运物流、快递配送、仓储货架等行业设计,支持PC+WAP自适应,确保在电脑、手机、平板等设备上均能流畅访问。适用于物流公司、仓储企业查看源码 -
帝国cms7.5个人博客资讯文章模板下载本模板简洁个人博客网站设计开发,采用帝国CMS内核构建,只需替换文字图片即可快速搭建专业网站。自适应手机端设计,数据实时同步,操作简单便捷。PHP程序确保安全稳定运行,帮助您以较低成本获取持续业务。查看源码 -
(PC+WAP)pbootcms模板黑色门窗定制五金建材网站下载为门窗定制与五金建材企业设计的网站解决方案,采用PbootCMS开发,兼具专业展示与营销功能。黑色系设计突显工业质感,响应式布局确保在手机、平板等设备上的浏览体验。通过简单的内容替换,也可适用于建材贸易、家具定制等相关行业。查看源码 -
(自适应响应式)黑色LED显示屏户外广告屏网站源码下载这是一款基于PbootCMS内核开发的响应式网站模板,专门为LED显示屏及户外广告行业打造。模板适配各类显示设备,帮助企业快速搭建专业官网,展示产品与服务优势,有效提升品牌形象。查看源码 -
(自适应响应式)html5文章资讯新闻博客pbootcms网站模板下载本模板基于PbootCMS系统开发,为新闻资讯、博客类网站设计,特别适合各类文章内容的发布与管理。采用响应式技术,确保在不同设备上都能获得良好的阅读体验。查看源码
| 分享笔记 (共有 篇笔记) |
