PHP Strict Standards错误
在部署项目时出现:Strict standards: Declaration of … should be compatible with that of …错误,我使用的是php 5.3.3
<?phpabstract class A {// 方法无参数public static function foo(){ echo 'bar'; }}abstract class B extends A {// 方法有参数public static function foo($str){ echo $str; }}?>
?
解决方法:
<?phpabstract class A {// 方法无参数public static function foo(){ echo 'bar'; }}abstract class B extends A {// 方法有参数public static function foo($str = NULL){ echo $str; }}?>
?
这是由于 php 5.3版本后。要本@文来源[email protected]搞@^&代*@码网(搞代gaodaima码
求继承类必须在父类之后定义。否则就会出现Strict Standards: PHP Strict Standards: Declaration of …. should be compatible with that of …. 的错误提示。也就是说必须父类在前,继承类在后。
?