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);

 

替換爲後,上傳到服務器.而後進入後臺,清空緩存便可. 

相關文章
相關標籤/搜索