我是蛋糕新手,我正试图在保存事件后让函数重定向..它适用于其他代码,例如用户,但不适用于事件之一..
该功能确实保存了事件,只是它不会重定向或使用 SETFLASH
这是我的事件控制器添加功能的代码:
public function add() {
if ($this->request->is('post')) {
$this->Event->create();
if ($this->Event->save($this->request->data)) {
$this->Session->setFlash(__('The event has been saved'));
$this->redirect(array('action' => 'eventmanage'));
} else {
$this->Session->setFlash(__('The event could not be saved. Please, contact the administrator.'));
}
}
}
任何帮助都会非常感谢!