,有以下幾行 http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.htmlCakePHP的2.0博客教程重定向所以在博客CakePHP的2.0教程爲了
<?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.');
}
}
}
爲什麼$這個 - >會話級> setFlash( '您的信息已更新。');在重定向行之前?一旦它被重定向,爲什麼消息會顯示出來,而不是反之亦然。首先重定向,然後刷新消息?