Zend 中的 Flash Messenger 类型
是否可能或我如何为 Zend 中的 FlashMessage 指定类型?
例如
/* This is a "Success" message */
$this -> _helper -> FlashMessenger('You are successfully created a post.');
/* This is an "Error" message */
$this -> _helper -> FlashMessenger('There is an error while creating post.');
/* This is just a "Notification" message */
$this -> _helper -> FlashMessenger('Now you can see your Post');
Is it possible or How can i give a type to a FlashMessage in Zend?
For example
/* This is a "Success" message */
$this -> _helper -> FlashMessenger('You are successfully created a post.');
/* This is an "Error" message */
$this -> _helper -> FlashMessenger('There is an error while creating post.');
/* This is just a "Notification" message */
$this -> _helper -> FlashMessenger('Now you can see your Post');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为最好的方法是使用 flashmessenger 命名空间:
然后在布局中,您可以将消息添加到每个命名空间:
I think the best way to do this is by using the flashmessenger namespaces:
And then in your layout you can get the messages added to each namespace:
有一次你使用关联数组来做到这一点...我不确定这是否仍然是当前的...
At one time you used assoc arrays to do this... Im not ure if this is still current or not...
这是可能的。此博客文章中描述的示例实现:
摘录:
It is possible. Sample implementation in described in this blog post:
Excerpt:
Zend Framework 1.12.x 中 FlashMessenger 的方法签名:
因此,要设置消息,以下内容将起作用:
对于视图,以下内容应该起作用:
Method signatures in Zend Framework 1.12.x for FlashMessenger:
So to set messages the following will work:
And for the view, the following should work: