【发布时间】:2011-01-18 12:25:51
【问题描述】:
我得到了熟悉的“致命错误:不在对象上下文中使用 $this”,指的是以下类中的 $this->test = 'test';:
class Example {
public $test;
public function index() {
$this->test = 'test';
}
}
类方法通过call_user_func_array(array('example', 'index'), $params); 调用。我只能假设call_user_func_array 出于某种原因决定将索引方法称为静态方法,例如example::index()?但是我还没有找到解决方法,奇怪的是直到最近我才遇到问题。
【问题讨论】: