所以在博客 cakephp 2.0 教程中,有以下几行 http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html
<?php
public function edit($id = null) {
$this->Post->id = $id;
if ($this->request->is('get')) {
$this->request->data = $this->Post->read();
} else {
if ($this->Post->save($this->request->data)) {
$this->Session->setFlash('Your post has been updated.');
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('Unable to update your post.');
}
}
}
为什么 $this->Session->setFlash('Your post has been updated.'); 去重定向线之前?一旦它被重定向,为什么会显示消息而不是反之亦然。首先重定向然后闪烁消息?