解决Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in D:

使用php5.5运行ecshop的时候出现如下错误Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in \ecshop\includes\cls_template.php on line 300

解决方法如下

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

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

替换成

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

重新运行问题以解决
官方说明http://www.php.net/manual/zh/reference.pcre.pattern.modifiers.php
ecshop2.7.3 preg_replace()怎么替换成preg_replace_callback()
 

 

来源://作者:/更新时间:2014-02-16
相关文章