繁体   English   中英

Zend框架 - 从当前操作向Controller中的另一个操作发送消息

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

在Zend框架中:如何从当前操作向Controller中的另一个操作发送消息?

这是使用FlashMessenger的一个非常简单的示例,因此您可以在代码中使用它:

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');
}

如果您在浏览器中指向“重定向”操作,则应该使用该消息获取indexAction。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM