静态方法中不能使用 $this

忽略了一个问题,$this 代表当前对象!! 静态方法中应该使用 类名 、 self 或者 static 关键字来代替!
    static
public function get_info($id) { var_dump($this); // NULL NULL 
       Fatal error: Using $this when not in object context in /home/apache/www/test/web/core/MY_Controller.php on line 80
}
原文地址:https://www.cnblogs.com/bravehunter/p/5694001.html