Laravels Flash会话两次存储数据 [英] Laravels flash session stores data twice
问题描述
这很头疼!根据我对laravel会话的flash方法的了解,一旦设置并调用它,它将被销毁...
this ones a head ache! From my understanding of laravel's flash method for sessions, once it has been set then called, it will be destroyed...
Session::flash( 'key', $data );
在某处
{{ Session::get( 'key' ) }}
我正在使用它进行表单验证.现在,当表单未通过验证时,应用程序显示错误,如果我修改表单并再次发布,则数据库更新,详细信息正确显示,但错误再次出现!如果我张贴未经验证的表单,它会显示错误,但是如果我然后单击同一页面的导航链接,它将再次显示!
I am using this for form validation. Now when the form does not validate, the application displayed the error, if I amend the form and post again, the database updates, the details are displayed correctly, but the error appears again! This is the same for if I post the form that doesn't validate, it displays the error, but if I then click the navigation link for the same page, it displays again!
有人碰到这个吗?
致谢
卢克
推荐答案
当我执行 return view()
/ return View :: Make
时,我遇到了这个问题在我的Controller @ update方法中应该是 return redirect()-> route()
的时候.
I had this problem once when I did a return view()
/ return View::Make
when it should be a return redirect()->route()
in my Controller@update method.
这篇关于Laravels Flash会话两次存储数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!