程序不斷的更新換代,php版本也在不斷的推陳出新,自從php7.0推出,php5.5版本已落伍,但是目前使用php5.5的也不少,接下來,小編給大家整理關于ECSHOP在PHP5.5及高版本上報錯的解決方法,小伙伴們一起來學習吧
Ecshop卻沒來得及修改,如果在高版本的php虛擬主機上安裝ecshop程序,出現兼容性問題。
小編在本地環境php5.5上安裝出現以下兩種報錯提示
:
Only variables should be passed by reference php
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead…?
通過在網絡上查找,小編發現并不是只能在低版本的php中安裝,也是找到了解決辦法,方便大家在php5.5版本上調試程序。小編就在這里把解決方法分享給大家:
先說明第一個問題的解決方法:
php 5.3以上版本的問題,和配置有關 只要418行把這一句拆成兩句就沒有問題了。
將下列:
- $tag_sel = array_shift(explode(' ', $tag));
修改為:
- $tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
因為array_shift的參數是引用傳遞的,5.3以上默認只能傳遞具體的變量,而不能通過函數返回值
第二個報錯解決辦法:
include/cls_template.php
找到文件:
將以下代碼:
- return preg_replace("/{([^/}/{/n]*)}/e", "/$this->select('//1');", $source);
修改成:
- return preg_replace_callback("/{([^/}/{/n]*)}/", function($r) { return $this->select($r[1]); }, $source);
小編目前只遇到這樣兩個報錯,如果在程序調試和開發過程中遇到其他的問題,如果能夠解決,小編也是會整理出解決方法的。
ecshop 在高版本PHP下報錯的解決方法
1 .ecshop提示Strict Standards: Non-static method cls_image
- ::gd_version() should not be called statically inE:/wwwroot/weirenchou/includes/lib_base.php on line 346
找到346行吧
- return cls_image::gd_version()
替換成:
- $p = new cls_image();return $p->gd_version();
2 .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);
3. Strict Standards: Only variables should be passed by reference in E:/web/shopex/includes/cls_template.php on line 422
- $tag_sel = array_shift(explode(' ', $tag));
改成:
- $tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
4 .會員整合出現
- phpbb::set_cookie() should be compatible with integrate
- /includes/modules/integrates/phpbb.php on line 232
- 110行
- function set_cookie ($username="")
修改成
- function set_cookie ($username="", $remember = NULL)
- includes/modules/integrates/phpwind6.php
ucenter.php vbb.php也是這樣修改
ucenter.php 210行修改成
- function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
127行修改成
- function login($username, $password, $remember = NULL)
5. 數據庫備份出現
- edefining already defined constructor for class cls_sql_dump
- /admin/includes/cls_sql_dump.php on line
- function __construct(&$db, $max_size =)
- {
- $this->cls_sql_dump($db, $max_size);
- }
移到function cls_sql_dump(&$db, $max_size=0)前面
- Non-static method cls_sql_dump::get_random_name() admin/database.php on line 64
打開includes/cls_sql_dump.php
479行
- function get_random_name()
修改成
- static function get_random_name()
新聞熱點
疑難解答