Home > Backend Development > PHP Tutorial > ECSHOP在PHP5.5及高版本上报错的解决方法_PHP

ECSHOP在PHP5.5及高版本上报错的解决方法_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-30 08:44:36
Original
1164 people have browsed it

Ecshop却没来得及修改,如果在高版本的php虚拟主机上安装ecshop程序,出现兼容性问题。

小编在本地环境php5.5上安装出现以下两种报错提示

Only variables should be passed by reference php
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead…?

通过在网络上查找,小编发现并不是只能在低版本的php中安装,也是找到了解决办法,方便大家在php5.5版本上调试程序。小编就在这里把解决方法分享给大家:

先说明第一个问题的解决方法:

php 5.3以上版本的问题,和配置有关 只要418行把这一句拆成两句就没有问题了。

将下列:

$tag_sel = array_shift(explode(' ', $tag));
Copy after login

修改为:

$tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
Copy after login

因为array_shift的参数是引用传递的,5.3以上默认只能传递具体的变量,而不能通过函数返回值

第二个报错解决办法:

找到文件:include/cls_template.php

将以下代码:

return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
Copy after login

修改成:

return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
Copy after login

小编目前只遇到这样两个报错,如果在程序调试和开发过程中遇到其他的问题,如果能够解决,小编也是会整理出解决方法的。

ecshop 在高版本PHP下报错的解决方法

1 .ecshop提示Strict Standards: Non-static method cls_image

::gd_version() should not be called statically inE:/wwwroot/weirenchou/includes/lib_base.php on line 346
Copy after login

找到346行吧

return cls_image::gd_version()
Copy after login

替换成:

$p = new cls_image();return $p->gd_version();
Copy after login

2 .ecshop的时候出现如下错误:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /ecshop/includes/cls_template.php on line 300
Copy after login

打开ecshop的目录找到includes/cls_template.php 到第300行

return preg_replace("/{([^
    
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template