CakePHPの新機能です.CakePHPのチュートリアルに従ってログイン機能を試していますが、誤ったユーザ名/パスワードを使用した後にエラーメッセージは表示されません。助けてください。要素がのsrc /テンプレート/エレメント/フラッシュの下に存在する必要がありFlashComponentのマジックメソッド__call()
を使用することによりCakePHP:エラー/成功メッセージは表示されません。
public function login()
{
if ($this->request->is('post')) {
$user=$this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect(['controller' => 'bookmarks']);
}
$this->Flash->error('Your username or password is incorrect');
}
}
コントローラにフラッシュモジュールを搭載しましたか? –