我不断收到此错误PHP Fatal error: Using $this when not in object context并且我一生都无法弄清楚原因。是否有另一双眼睛可以提供帮助?我有另一个类似设置的类,并且没有抛出错误。代码如下(为了便于阅读,略读):
include '< const class id >.php';
class ParseFunctions {
private $_id = '';
public function __construct(){
$id = new IDS;
$this->_id = $id::<const class id>;
}
public function set_id(){
$new_id = $this->id; <--- this line throws the error
$print_r($new_id);
}
}
任何帮助表示赞赏!谢谢你!