[英]pass value to route and then controller
這是我的看法
<a href="{{URL::route('audit_crawling')}}"class="clear active"> </a>
我想將值傳遞給路由,值在$ id變量中
{{URL::route('audit_crawling'.$id)}}
我想在這里獲取此值並傳遞給控制器
Route::get('/dashboard',[
'as'=>'audit_crawling',
'uses'=>'ProjectController@audit_crawling'
]);
這是我的控制器代碼
function audit_crawling($id)
{
data=['id'=>$id];
return view('user.project.dashboard',$data);
}
要將數據傳遞給控制器,請使用:
路線:
Route::get('/dashboard/{id}',[
'as'=>'audit_crawling',
'uses'=>'ProjectController@audit_crawling'
]);
調節器
public function audit_crawling($id) {
echo $id;
}
鏈接:
<a href="{{route('audit_crawling',$id)}}" class="clear active"> </a>
要么
<a href="{{url('dashboard/'.$id)}}" class="clear active"> </a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.