0

我现在正在练习 CakePHP 的博客教程,我按照它的每一步或指令进行操作。不过,我无法添加帖子,因为弹出此错误:

Error: Call to undefined method FlashComponent::error() 
File: C:\xampp\htdocs\sembreak\app\Controller\PostsController.php   
Line: 29

这个错误的原因是什么,我该如何解决这个问题?

4

1 回答 1

1

您不想使用$this->Session->setFlash()低于$this->Flash->error()2.7.0 的 CakePHP 版本:-

$this->Session->setFlash(__('Unable to add your post.'));

线索在您收到“调用未定义方法”的错误消息中。

于 2015-10-30T07:59:24.733 回答