你们知道如何获取带参数的网址吗?使用laravel 5.3的关键字? 我希望从URL看起来变量
http://site.dev/user/direct?TransID=42D215C2&CCDapproval=72159&PnrID=gogo&Token=42D215C&CompanyRef=gogo
我的路线
Route::group(['prefix' => 'user', 'middleware' => 'auth:user'], function()
{
Route::get('/directpay/{id}', 'DirectController@index');
}
ERROR
Sorry, the page you are looking for could not be found.
1/1
NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 766
at Router->findRoute(object(Request)) in Router.php line 621
at Router->dispatchToRoute(object(Request)) in Router.php line 607
at Router->dispatch(object(Request)) in Kernel.php line 268
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 150
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
at Kernel->handle(object(Request)) in index.php line 54
如何实现它谢谢。
答案 0 :(得分:0)
改变:
Route::get('/directpay/{id}', 'DirectController@index');
为:
Route::get('/direct', 'DirectController@index');
匹配这个:
http://site.dev/user/direct?TransID=42D215C2&CCDapproval=72159&PnrID=gogo&Token=42D215C&CompanyRef=gogo
你可以得到这样的参数:
$PnrID = Input::get('PnrID');
或者像这样:
$PnrID = request()->get('PnrID');