问题
In Zend framework: how can I send a message from the current action to another action in Controller?
回答1:
This is a very simple example of using FlashMessenger, so you can use it on your code:
public function indexAction()
{
$messages = $this->_helper->FlashMessenger->getMessages('actions');
echo $messages[0];
}
public function redirectAction()
{
$this->_helper->FlashMessenger->addMessage("Your message", 'actions');
$this->_redirect('index/index');
}
If you point in browser at 'redirect' action, you should get indexAction with the message.
来源:https://stackoverflow.com/questions/8400000/zend-framework-send-a-message-from-the-current-action-to-another-action-in-con