我正在学习Cakephp。在我的PostsController中
$this->Flash->success(__('Your post has been saved.'));
给出如下错误
错误:'Call to a member function success() on a non-object'
请问原因是什么?
这是因为你没有加载FlashComponent。要修复它,在PostsController类定义中插入以下内容var $components = array ('Flash');
您还没有加载Session组件。var $components = array('Session');