Cakephp 使用cake的反馈/确认页面

Cakephp 使用cake的反馈/确认页面,cakephp,Cakephp,在输入两个字段并单击提交后,实现文本反馈的最佳方式是什么 在控制器中,您可以设置 if ($this->Items->save($this->data)) { $this->Session->setFlash('Your data has been submitted'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFl

在输入两个字段并单击提交后,实现文本反馈的最佳方式是什么


在控制器中,您可以设置

if ($this->Items->save($this->data)) {
    $this->Session->setFlash('Your data has been submitted');
    $this->redirect(array('action'=>'index'));
} else {
    $this->Session->setFlash('Error saving the data');
}


或者,您可以重定向到“成功完成”页面。有些第三方,如易趣,可能会要求您这样做


决定您希望应用程序如何运行并以这种方式实现它

如果你把更多的精力和深度放在你的问题上,你会从人们那里得到更好的答案(除了股票,“检查手册”)。说真的,手册涵盖了很多这方面的内容,尤其是教程。还可以查看IBMdeveloperWorks的文章(尽管它们现在有点过时,IIRC)。
if ($this->Items->save($this->data)) {
    $this->flash('Your data has been submitted', '/items/', 5);
}