我知道有解决办法,但没有一个对我有用。这是我的超链接
<a href="{{route('voting',$parameters = array('id' =>$answers->id,'votes' =>"1"))}}"><span class="glyphicon glyphicon-chevron-up"></span></a>这是我的路线,我试过这条路
Route::get('voting','AnswerController@voting')->name("voting");然后这个
Route::get('voting',array('as'=>'voting','uses'=>'AnswerController@voting'));我的控制器
public function voting($id,$votes){
//rest of code
}我所面临的问题
“函数App\Http\Controllers\AnswerController::voting(),0传递的参数太少,而预期的参数正是2”
发布于 2018-08-16 23:09:56
我相信你需要给出路线2的参数
Route::get('voting/{id}/{votes}', array('as'=>'voting','uses'=>'AnswerController@voting'));请参阅此线程
发布于 2018-08-16 23:32:00
使用这个
<a href="{{ route('voting',['id' => $answers->id, 'votes' => 1]) }}"><span class="glyphicon glyphicon-chevron-up"></span></a>而不是
<a href="{{route('voting',$parameters = array('id' =>$answers->id,'votes' =>"1"))}}"><span class="glyphicon glyphicon-chevron-up"></span></a>https://stackoverflow.com/questions/51886257
复制相似问题