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.
标签:
zend-framework