ecshop因php版本過高引起的7報(bào)錯(cuò)這個(gè)是因高版本的php已經(jīng)不支持舊版本的一些方法與函數(shù)了,我們下面來看一篇關(guān)于ecshop因php版本過高引起錯(cuò)誤的問題解決辦法。
ecshop兼容PHP版本較低,不兼容PHP更高的版本,如果使用其他版本可能會(huì)出現(xiàn)各種錯(cuò)誤,如以下七種錯(cuò)誤問題:
1、Strict Standards: Non-static method cls_image::gd_version() should not be called statically
未聲明靜態(tài)static將
return cls_image::gd_version();
替換為
$p = new cls_image();
return $p->gd_version();
2、Strict Standards: Only variables should be passed by reference
變量應(yīng)該通過引用傳遞將
$tag_sel = array_shift(explode(' ', $tag));
替換為
$tag_arr = explode(' ', $tag);
$tag_sel = array_shift($tag_arr);
3、Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in
將
return preg_replace("/{([^}{
]*)}/e", "$this->sel ect('\1');", $source);
替換為
return preg_replace_callback ("/{([^}{
]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);
4、Strict Standards: Redefining already defined constructor for class paypal
PHP 類,有兩種構(gòu)造函數(shù),一種是跟類同名的函數(shù),一種是 ____construct()。從PHP5.4開始,對這兩個(gè)函數(shù)出現(xiàn)的順序做了最嚴(yán)格的定義,必須是 ____construct() 在前,同名函數(shù)在后。
例如:
function __construct()
{
$this->paypal();
}
function paypal()
{
}
5、mktime(): You should be using the time() function instead
mktime()方法不帶參數(shù)被調(diào)用,將
$auth = mktime();
替換為
$auth = time();
6、Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL)
子類的函數(shù)跟父類的同名,必須使子類的函數(shù)參數(shù)跟父類的對應(yīng)函數(shù)參數(shù)個(gè)數(shù)相同
依據(jù)錯(cuò)誤提示,修改例如:
function set_cookie ($username="")
改為
function set_cookie ($username="", $remember = NULL)
7、Parse error: syntax error, unexpected ';'
語法錯(cuò)誤,缺少;或者echo沒有輸出值