在安装ECShop V2.7.3版本时,安装程序会提示错误,错误信息:Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:phpstudyWWWshopinstallincludeslib_installer.php on line 31,出错位置代码如下:
1
|
function get_gd_version() { include_once(ROOT_PATH . 'includes/cls_image.php'); return cls_image::gd_version(); }
|
这个错误的原因是程序调用的cls_image类中的gd_version()不是static静态方法,无法通过::直接调用方法。
解决方法有两种:
一,创建cls_image类的对象后再调用相应方法,将上述代码改为如下形式:
1
|
function get_gd_version() { include_once(ROOT_PATH . 'includes/cls_image.php'); $gv = new cls_image(); return $gv->gd_version(); }
|
二,修改cls_image类中的gd_version()方法为静态方法,打开include/cls_image.php文件,将678行的function gd_version()改成static function gd_version()即可。
因为在ECShop中存在多处这种调用方法,为了避免反复报错修改,所以强烈推荐采用第二种方法。