したがって、ブログ 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.'); リダイレクト行の前に移動しますか? リダイレクトされると、メッセージが表示されるのはなぜですか。その逆はありません。最初にリダイレクトしてからメッセージをフラッシュしますか?