当我尝试在方法中设置flash数据时,它在重定向后不存在。 这是一个例子:
function logout() { $this->session->set_flashdata('auth_msg', 'you have been logged out'); redirect('admin/login'); }问题是当我在flashdata中检查auth_msg的值时,它不存在,并且用户指南并没有真正显示使用它时要使用的方法。 与我想做的事情一起使用的最佳方法是什么?
谢谢
When I try to set flash data in a method it doesnt exist after a redirect. Here is an example:
function logout() { $this->session->set_flashdata('auth_msg', 'you have been logged out'); redirect('admin/login'); }Problem is when I check for the value of auth_msg in flashdata, it doesnt exist and the user guide doesnt really show what method is bet to use when using this. What is the best method to use with what I am trying to do?
thanks
最满意答案
原因是因为Flash数据使用会话。
你刚刚在你的logout()函数中销毁了会话(我猜)。
因此,这是您在应用程序中无法使用flashdata的单一位置 。
在其他地方尝试它,它应该像你编码一样工作。
The reason is because flash data uses the session.
You have just destroyed the session on your logout() function (I'm guessing).
Therefore this is the one single place you cannot use flashdata in your application.
Try it somewhere else and it should work as you have coded.
更多推荐
发布评论