Strict Standards: Non-static method Test::getAllTest() should not be called statically in /Test.php on line 20

Strict Standards: Non-static method Test::getAllTest() should not be called statically in /Test.php on line 20
php报错:Strict Standards: Non-static method Test::getAllTest() should not be called statically in /Test.php on line 20

提示意思:这个getAllTest()方法不是静态方法,不可以这样调用!

解决方案1(改为静态方法):

#原来方法:
function Test(){
    return []'
}
#修改后:
function static Test(){
    return []'
}

解决方案2:

不这样调用,先new个对象! 在用对象去调用这个方法,代码就不上了,自己写吧~~


Strict Standards: Non-static method Test::getAllTest() should not be called statically in /Test.php on line 20

喜欢(0)

评论 抢沙发

表情