我试图在Zend Framework中使用此函数重定向到同一页面,但我没有收到我在此函数中设置的Flash消息有人请帮助我
但是如果在执行此代码后单击其他resut,我可以看到该错误消息。
提前致谢....
public function deleteAction()
{
if( $this->_helper->getHelper('FlashMessenger')->getMessages()) {
$this->view->message = $this->_helper->getHelper('FlashMessenger')->getMessages();
}
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout()->disableLayout();
if($this->getRequest()->getParam('id')){
$surfaceReservation = Doctrine_Core::getTable('Model_Reservation')->findOneById($this->getRequest()->getParam('id'));
if($surfaceReservation) $surfaceReservation->delete();
$this->_helper->getHelper('FlashMessenger')->addMessage('Deleted Successfully');
}
$this->_redirect('/arena/surface/reservation');
}
答案 0 :(得分:0)
确保您的目标操作是将消息分配给其视图。
if( $this->_helper->getHelper('FlashMessenger')->getMessages()) {
$this->view->message = $this->_helper->getHelper('FlashMessenger')->getMessages();
}