Laravel重定向回with()消息 [英] Laravel Redirect Back with() Message
本文介绍了Laravel重定向回with()消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当出现致命错误时,我正尝试通过消息重定向到上一页.
I am trying to redirect to the previous page with a message when there is a fatal error.
App::fatal(function($exception)
{
return Redirect::back()->with('msg', 'The Message');
}
在试图使用
Sessions::get('msg')
但是什么都没有渲染,我在这里做错了吗?
But nothing is getting rendered, am I doing something wrong here?
推荐答案
尝试
return Redirect::back()->withErrors(['msg', 'The Message']);
在您的视图内调用此
@if($errors->any())
<h4>{{$errors->first()}}</h4>
@endif
这篇关于Laravel重定向回with()消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文