Fatal error: Using $this when not in object context in 解决方法

粗心造成的错误

$this 只存在于下面情况

$obj = new objectTest();

$obj->test();

这种方法调用时,class中可以使用$this调用类中函数。

假如:

objectTest::test();

这种方法调用时,是不存在$this的,可以用self::来调用类中函数。

发表评论