安裝ecshop2.7時候的錯誤處理 php版本不相容引起

來源:互聯網
上載者:User

標籤:

裝ECShop2.7.3出現了一堆問題,主要是因為PHP版本過高引起的,不願意降低版本,則只能一個個解決啦!這些問題包括:preg_replace、cls_image::gd_version、end(explode(‘.‘, $tmp))。

 

 

一、關於preg_replace

    因為使用PHP5.5.x,ECShop安裝完成之後出現了下面提示,特別是在cls_template.php檔案中。下面就將需要替換的部分一一替換。

Deprecated: preg_replace(): The /e modifier is deprecated,use preg_replace_callback instead.

下面是需要替換內容:

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

替換為:

return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); },     $source);
$out = "<?php \n" . ‘$k = ‘ . preg_replace_callback("/(\‘\\$[^,]+)/e" ,     "stripslashes(trim(‘\\1‘,‘\‘‘));", var_export($t, true)) . ";\n";

替換為:

$out = "<?php \n" . ‘$k = ‘ . preg_replace_callback("/(\‘\\$[^,]+)/" ,     function($ro) { return stripslashes(trim($ro[1],‘\‘‘));}, var_export($t, true)) . ";\n";
$val = preg_replace("/\[([^\[\]]*)\]/eis", "‘.‘.str_replace(‘$‘,‘\$‘,‘\\1‘)", $val);

替換為:

$val = preg_replace_callback("/\[([^\[\]]*)\]/is",     function($ro) {return ‘.‘.str_replace(‘$‘,‘\$‘,$ro[1]);}, $val);
$source      = preg_replace($pattern, $replacement, $source);

替換為:

$pattern = ‘/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s‘;$source = preg_replace_callback($pattern, function($ro)    {return ‘{include file=‘.strtolower($ro[1]). ‘}‘;}, $source);

二、關於cls_image::gd_version

    將靜態調用改為執行個體調用。

return cls_image::gd_version();

替換為:

$p = new cls_image();



    return $p->gd_version();

 

三、關於end(explode(‘.‘, $tmp));

    將串連運算拆分即可。

$ext = end(explode(‘.‘, $tmp));

替換為:

$arr = explode(‘.‘, $tmp);    $ext = end($arr);

 

安裝ecshop2.7時候的錯誤處理 php版本不相容引起

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.