ecshop那些事

是否是对最新版本的php 适配ecshop很苦恼.最近我就遇到了这个事情,最终我花了一个小时的时间把这个问题解决了.php

特放出来,方便你们查阅.缓存

 

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in   \includes\cls_template.php on line 300 的错误,请问我应该怎么改?服务器

 

这个错误存在于ecshop 最高版本2.7.3 ,在php 5.4 以上版本都存在.工具

下面我列出须要改动的地方.this

 

用editplus或者其余工具,不建议用记事本,由于可能会改变原有文件的编码格式.编码

 

第300行 ip

 原有内容:it

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

修改后内容: function

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

 

第491行

原有内容:

//$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";

 

修改后内容:

  $out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , 

function($match){return stripslashes(trim($match[1],'\''));}

, var_export($t, true)) . ";\n";

 

第550行

原有内容:

 //$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);

修改后内容:

$val = preg_replace_callback(

'/\[([^\[\]]*)\]/is',

function ($matches) {

return '.'.str_replace('$','\$',$matches[1]);

},

$val

);

 

第1080行

原有内容:

 

//$source      = preg_replace($pattern, $replacement, $source);

修改后内容:

 $source      = preg_replace_callback($pattern, 

function ($matches) { return '{include file='.strtolower($matches[1]). '}';},

$source);

 

替换为后,上传到服务器.而后进入后台,清空缓存便可. 

相关文章
相关标签/搜索