这是我的视图文件中的代码段.
@foreach($infolist as $info) <a href="">{{$info->prisw}} / {{$info->secsw}}</a> @endforeach
这是我在路径文件中定义的路线
Route::get('switchinfo','SwitchinfoController');
解决方法
由于您尝试将两个参数传递给控制器,
您的控制器可能如下所示:
<?PHP namespace App\Http\Controllers; class SwitchinfoController extends Controller{ public function switchInfo($prisw,$secsw){ //do stuffs here with $prisw and $secsw } }
你的路由器看起来像这样
$router->get('/switchinfo/{prisw}/{secsw}',[ 'uses' => 'SwitchinfoController@switchInfo','as' => 'switch' ]);
然后在你的刀锋中
@foreach($infolist as $info) <a href="{!! route('switch',['prisw'=>$info->prisw,'secsw'=>$info->secsw]) !!}">Link</a> @endforeach