1
如何重定向URL的格式如下:重定向URL与可变在Laravel 5
我的代码:
return Redirect::to('home/viewcustomer/$cusid')
->with('status','success')
->with('message','success');
例子:
home/viewcustomer/8
如何重定向URL的格式如下:重定向URL与可变在Laravel 5
我的代码:
return Redirect::to('home/viewcustomer/$cusid')
->with('status','success')
->with('message','success');
例子:
home/viewcustomer/8
你需要花费大约照顾你在字符串引号内使用变量时使用string quotes。只需更新代码
Redirect::to('home/viewcustomer/$cusid')
到
Redirect::to("home/viewcustomer/$cusid")
^^ ^^
嗯,我通常用
会话和重定向,所以你必须在你的控制器来定义它
Use Session;
Use Redirect;
然后
public function example(){
Session::flash('status','Your message');
return Redirect::to('/yourRoute');
}
如果你想在你的视图来显示你的消息,你必须做到这一点...
@if(Session::has('status'))
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<p><strong>Success!!</strong> </p>
<ul>
<li>{{ Session::get('status') }}</li>
</ul>
</div>
@endif
希望这有助于!
ps:对不起英文不好:)
试试这个'Redirect :: to('home/viewcustomer /'。cusid)'' –