首页建站经验 PHP5.6.6上运行 ecshop 2.7.3常见问题整合

PHP5.6.6上运行 ecshop 2.7.3常见问题整合

ecshop在在PHP5.6.6版本以后,有了很多细微的变化。而ECSHOP官方更新又太慢,发现这些问题后也不及时升级,导致用户安装使用过程中错误百出。整理一下我遇到的问题希望对你们能有…

ecshop在在PHP5.6.6版本以后,有了很多细微的变化。而ECSHOP官方更新又太慢,发现这些问题后也不及时升级,导致用户安装使用过程中错误百出。

整理一下我遇到的问题希望对你们能有些帮组也为了自己以后查看。

问题1:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in cls_template.php XXX line

出错原因:

出现以上问题是 preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x 中已经被弃用了。在PHP 5.5以上的版本用 preg_replace_callback 函数替换了 preg_replace函数。

解决方法:

 解决问题的方法就是将代码中使用 preg_replace 函数的部分全部替换成 preg_replace_callback 函数,并且将一被废弃的 /e 修饰符 删除。

例子:

return preg_replace("/{([^}{n]*)}/e", "$this->sel ect('1');", $source);

替换为

return preg_replace_callback("/{([^}{n]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);

问题2:

Strict Standards: Only variables should be passed by reference in ......includescls_template.php on line 418

出错原因:

出现这个问题的原因,貌似在php5.4中array_shift只能为变量,不能是函数返回值。

解决方法:

$tag_sel = array_shift(explode(‘ ‘, $tag));

替换成

$tag_arr = explode(‘ ‘, $tag);

$tag_sel = array_shift($tag_arr);

问题3:

Strict Standards: Non-static method cls_image::gd_version() should not be called statically in ......includeslib_base.php on line 346 或者

Strict Standards: Non-static method cls_image::gd_version() should not be called statically in ......includeslib_installer.php on line 31

出错原因: //www.zuimoban.com

如问题中提示的一样,因为 cls_image.php 中 gd_version() 不是 static 函数所以在lib_base.php 与 lib_installer.php 中调用时才会出现以上问题。

解决方法:

  解决方法1: 首先在 lib_image.php 文件中,用 Shift+F 去搜索 gd_version 函数。然后在gd_version 方法前加 static 修饰符,是此函数变成静态函数。

解决方法2: 在lib_base.php 与 lib_installer.php 函数中找到 cls_image::gd_version() 部分, 然后分别创建cls_image 实例,之后用创建的实例再去调用 gd_version() 函数。

$cls_gile = new cls_image();

return $cls_gile->gd_version();

问题4:

Deprecated: Assigning the return value of new by reference is deprecated in…

出错原因:

PHP5.3+废除了”=&”符号,对象复制用”=”

解决方法:

搜索所有PHP文件,将”=&”替换为”=”

问题5:

Strict Standards: mktime(): You should be using the time() function instead in ......adminshop_config.php on line 32

出错原因:

这个错误提示的意思:mktime()方法不带参数被调用时,会被抛出一个报错提示。

解决方法:

$auth = mktime();

将mktime()替换成time()方法,代码为:

$auth = time();

问题6:

Strict Standards: Redefining already defined constructor for class cls_sql_dump ......

出错原因:

原因跟PHP类中的构造函数有关,PHP早期版本是使用跟类同名的函数作为构造函数,后来又出现了使用 __construct()作为构造函数,

这俩个函数可以同时存在。到了PHP5.4版本,对这俩个函数在代码中的先后顺序有了严格的要求。在PHP5.4版本下,必须__construct() 在前,

同名函数在后,否则就会出现上面的的错误提示。

解决方法:

把__construct()函数放在,同名函数上面就行了。

问题7:

Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL)

出错问题:

vbb继承了integrate类并且重写了 set_cookie() 函数,但vbb重写set_cookie函数的参数 与 其父类set_cookie 的参数不符所以出现以上问题。

解决方法:

function set_cookie ($username="")

改为

function set_cookie ($username="", $remember = NULL)

如出现类似错误,可以以同样的方法解决。

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/jianzhan/jingyan/17732.html
上一篇在Centso服务器上安装ECShop详细方法
下一篇 解决ecshop商品列表显示异常问题
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部