【发布时间】:2013-08-16 13:33:07
【问题描述】:
我已经在我的UsersController 中设置了validationErrors 用于登录:
public function login() {
if ($this->request->is('post')) {
$this->User->set($this->request->data);
if ($this->User->validates() && $this->Auth->login()) {
$this->set('ui', $this->Auth->user('id'));
$this->Session->setFlash(__('Loged in!'), 'flash_success');
$this->redirect($this->Auth->redirect());
} else {
$errors = $this->User->validationErrors;
}
}
}
现在我如何在我的视图中使用$error 或作为要在我的表单上方列出的元素?
请帮助我搜索了很多,但答案是针对旧的 CakePHP,我使用的是 CakePHP 2.3.8。
【问题讨论】:
标签: php cakephp-2.3