ecshop网站上传到服务器出现Deprecated: preg_replace()

商城首页出现这样的错误:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\websoft\web\hnxsjmy\shop\includes\cls_template.php on line 300
 
Strict Standards: Only variables should be passed by reference in C:\websoft\web\hnxsjmy\shop\includes\cls_template.php on line 418

解决:

return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
//替换成如下
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

只要418行把这一句拆成两句就没有问题了  $tag_sel = array_shift(explode(' ', $tag)); 改成: $tag_arr = explode(' ', $tag);  $tag_sel = array_shift($tag_arr);

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Grow your business fast with

Suku