重定向网址工作正常,但信息没有显示.看起来with方法没有工作.
控制器
return redirect('/Patient_Home')->with(['payment_success','Payment has been completed successfully']);
观点
@if(Session::has('payment_success'))
<div class="alert alert-success" style="text-align:center">
{{Session::get('payment_success')}}
</div>
@endif
应该是。
return redirect()->route('your patient home route')->with('payment_success','Payment has been completed successfully');
在刀片视图中,试试这个。
@if ($message = Session::get('payment_success'))
{{ $message }}
@endif
另外,运行这个命令来清除缓存。php artisan optimize:clear
谢谢
你已经创建了一个RedirectResponse实例,以在一个方法链中向会话闪现数据。这也适用于存储操作后的状态信息。
return redirect('/Patient_Home')->with(['payment_success','Payment has been completed successfully']);
@if (session('payment_success'))
<div class="alert alert-success">
{{ session('payment_success') }}
</div>
@endif