PHP5.5 5.4安装ecshop出错 解决方案 cls_template.php on line 300

之前给客户安装模板时发现,模板报错这种问题,后来一看才发现,是php版本过高的问题。现在68ecshop的技术为您讲述下,

php版本过高出现的\includes\cls_template.phpon line 300问题的解决方法。

出错问题如下所示 :

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in D:\xampp\htdocs\tutechan\includes\cls_template.phpon line 300

解决方案如下所示:

打开 includes\cls_template.php 文件:按快捷键CTRL+G 300 来到第300行

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

//替换成如下代码

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

保存后,刷新一下看看是否完美了!

解决方法思路:

由于方法preg_replace()为PHP 5.5.x 中废弃的特性,,官方建议需要在代码中将preg_replace()替换为函数preg_replace_callback,可以问题解决。

夫妇一条心,泥土变黄金。

PHP5.5 5.4安装ecshop出错 解决方案 cls_template.php on line 300

相关文章:

你感兴趣的文章:

标签云: