您现在的位置是:首页 > cms教程 > ecshop商城教程ecshop商城教程

ecshop适配PHP5.6的方法

千萍2025-01-17ecshop商城教程已有13人查阅

导读适配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 ,找到
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);

本文标签:

很赞哦! (2)

暂无内容
暂无内容

相关教程

相关源码

  • 响应式pbootcms模板新闻资讯博客自媒体门户网站行业通用解决方案为新闻资讯、自媒体博客打造的响应式网站模板,同时支持企业门户、行业资讯等多场景快速适配。通过简单的图文替换即可实现跨行业转型,显著降低建站成本。查看源码
  • (PC+WAP)铝合金门窗定制pbootcms网站模板源码为铝合金门窗、定制门窗企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5自适应架构,PC与手机端数据实时同步,覆盖全终端用户交互场景。查看源码
  • PbootCMS(自适应手机端)智能电话AI机器人网站模板产品概述基于PbootCMS内核开发的智能电话AI机器人网站模板,为语音交互服务场景设计,采用HTML5+CSS3响应式布局技术,实现PC端与移动端数据实时同步展示。模板适用于智能电话查看源码
  • pbootcms模板(PC+WAP)火锅加盟餐饮美食类带留言源码基于PbootCMS内核深度开发,为火锅、餐饮品牌打造的营销型解决方案。采用红色主题传递行业活力,实现PC与WAP端适配。查看源码
  • pbootcms模板(PC+WAP)微信小程序开发公司网站本模板为微信小程序开发代理、软件开发公司等企业设计,基于PbootCMS内核开发,支持PC+WAP双端响应式布局,数据实时同步,适用于多行业快速建站。查看源码
  • 自适应APP应用程序介绍推广落地页pbootcms网站源码下载移动应用开发商设计的营销型落地页模板,基于PbootCMS内核深度开发采用前沿响应式架构,无缝适配手机端操作习惯与PC端展示需求。查看源码
暂无内容
暂无内容
分享笔记 (共有 0 篇笔记)
昵称:
匿名发表 登录账号
         
验证码: