在我看来,我有:
<?php echo $this->Session->flash(); ?>
在我的UsersController中我有:
public function login() {
$this->Session->delete('Flash.auth');
$this->Session->delete('Message.flash');
$this->Session->delete('auth');
$this->Session->delete('Message.auth');
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect(array('controller' => 'users', 'action' => 'index')));
} else {
$this->Session->setFlash('Invalid username or password, please try again', null, null);
}
}
问题是即使成功登录后我的flash消息仍然存在 .
PR($这 - >会话级>读());产生:
Array
(
[Config] => Array
(
[userAgent] => adcb84540c454620867cea3249a69ca1
[time] => 1544388026
[countdown] => 10
)
[Message] => Array
(
[flash] => Array
(
[message] => Invalid username or password, please try again
[element] => default
[params] => Array
(
)
)
)
)