PHP 大于5.3版本,5.4 版本错误兼容处理方式

时间:13-03-08 栏目:问题及解决 作者:admin 评论:1 点击: 13,350 次

PHP 大于5.3版本,5.4 版本错误兼容处理方式

PHP5.2项目迁移到PHP5.4版本后,常见以下错误:
Strict standards: Declaration of ... should be compatible with that of
Non-static method classs::fun() should not be called statically

 

屏蔽此类错误的方法:

$error_level =(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^E_STRICT);

但不建议这样做,如果样在代码层面解决 的话:

 

错误提示:

Strict Standards: Non-static method xxx() should not be called statically
解决办法:
修改被调用类中 xxx() 方法为公共静态方法,即: public static function xxx(){...}
错误提示:
Strict standards: Declaration of ... should be compatible with that of ...错误
要求继承类必须在父类之后定义。否则就会出现Strict Standards: PHP Strict Standards: Declaration of .... should be compatible with that of .... 的错误提示。也就是说必须父类在前,继承类在后。

参考:

http://xiaoqiang6775.iteye.com/blog/1392055

http://feeling84321.blog.163.com/blog/static/1278880202012328913380/

 

声明: 本文由( admin )原创编译,转载请保留链接: PHP 大于5.3版本,5.4 版本错误兼容处理方式

PHP 大于5.3版本,5.4 版本错误兼容处理方式:目前有1 条留言

  1. 不错

    2013-04-08 10:30 pm [回复]

发表评论


------====== 本站公告 ======------
联系信息:
电话:19970108113(微信同号) QQ:3142401606
支付宝:https://me.alipay.com/lxq73061
相关插件程序等信息均会在站内发布,敬请关注。

读者排行