我正在使用 Cakephp 2.3.0,加载以下组件。
class BreadCrumbsComponent extends Component {
public $components = array();
public $controller = null;
public function initialize($controller) {
}
public function startup($controller) {
$this->controller = $controller;
}
public function beforeRender($controller) {
}
public function shutDown($controller) {
}
public function beforeRedirect($controller, $url, $status = null, $exit = true) {
}
public function handle($controllerName = NULL, $actionName = NULL) {
pr($this->controller->modelClass);
}
}
错误后出现错误
Trying to get property of non-object [APP\Controller\Component\BreadCrumbsComponent.php, line 38]
我无法访问 $this->controller 那里。任何原因?我如何使它工作?