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)'' –