这是显示“闪现消息”的最佳方式在科哈纳 v3 中?
我想知道在 Kohana v3 中显示闪现消息的最佳方式?
一些教程或示例会很有帮助。
I would like to know the best way to display flash messages in Kohana v3?
Some tutorials or examples would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你的意思是像 Kohana 2.x 的 flash 会话变量吗?
最新的 Kohana 支持
get_once()< /code>
这与旧的 Flash 会话变量非常相似。
Do you mean like Kohana 2.x's flash session variables?
The latest Kohana supports
get_once()
which is pretty similar to the old flash session variables.我认为 get_once 是一个很棒的函数,但是如果您想让数据实际上与常规数据分开,这里有一个重载“Session”的基本类,以便您可以对任何数据存储使用“codeigniter”样式的 flashdata 调用。
我意识到这个问题有一个答案,就像我之前所说的那样, get_once 方法很棒,但我更喜欢自动垃圾收集。
如果您对此代码有任何改进,请告诉我,到目前为止它对我来说非常好。
I think the get_once is a great function, but what if you want to keep the data actually separate from the regular data, here's a basic class that overloads "Session" so that you can use "codeigniter" style flashdata calls with any data-store.
I realize there was an answer to this, and like i stated before, the get_once method is great and all, but i enjoy auto garbage collection much more.
If you have any improvements on this code, let me know, its been great to me so far.
看看这个模块,它可能就是您正在寻找的 https://github.com/daveWid/message< /a>
Have a look at this module, it might be what you are looking for https://github.com/daveWid/message
我曾经为此编写过一个非常简单的类。看看下面。下面的用法示例
示例(假设此类保存为
APPPATH . 'classes/notice.php'
):编辑:有趣...出于某种原因,这个问题在某处弹出,没有注意到它是一个非常旧的...抱歉!
I've written a really simple class for this once. Check it out below. Usage examples below
Examples (provided this class is saved as
APPPATH . 'classes/notice.php'
):EDIT: funny... for some reason this question popped up somewhere, didn't notice it was a really old one... sorry for that!
我在我的项目中使用 https://github.com/synapsestudios/kohana-notices我对此非常满意。
I am using https://github.com/synapsestudios/kohana-notices in my project and I am very happy with it.