Zend framework - send a message from the current action to another action in Controller

我与影子孤独终老i 提交于 2019-12-10 19:43:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!