【发布时间】:2012-02-13 15:34:45
【问题描述】:
我们开始关注网站 cakephp.org - http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html 上托管的 CakePHP 博客教程
此时,我们在提交表单后陷入重定向(即功能编辑/添加)。这就是我们的代码的样子:
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($this->referer());
} else {
$this->Session->setFlash('Unable to update your post.');
}
}
}
在评论$this->redirect($this->referer()); 行后,页面引用了他自己的...添加行后,它将停留在空白页面上。
示例:http://www.drukwerkprijsvergelijk.nl/posts/
请帮助这只小猫,我们很绝望。
【问题讨论】:
标签: php mysql cakephp redirect