Laravel 路由参数根本不关心
Laravel route parameters don't care at all
我来自这里:
Laravel pagination trouble with offset
调查我的代码,我发现当通过路由给出随机 alike 参数时,它将执行 like 查询或者我不知道,但它仍然可以工作,因为它将获得参数的第一部分:
我试图“确保”的路线是这样的:
Route::get('/videos/cats/{race_id}/{cat_id}, [App\Http\Controllers\MeowController::class, 'getCatVideo']);
谁能帮我得到 那个 确切的整数参数,或者如果参数不完全是给定的参数则阻止路由工作?
提前致谢。
默认需要参数。
验证参数:
Route::get('/videos/cats/{race_id}/{cat_id}, [App\Http\Controllers\MeowController::class, 'getCatVideo'])
->where('race_id', '\d+')
->where('cat_id', '\d+');
有用link:https://laravel.com/docs/8.x/routing#parameters-regular-expression-constraints
我来自这里: Laravel pagination trouble with offset
调查我的代码,我发现当通过路由给出随机 alike 参数时,它将执行 like 查询或者我不知道,但它仍然可以工作,因为它将获得参数的第一部分:
我试图“确保”的路线是这样的:
Route::get('/videos/cats/{race_id}/{cat_id}, [App\Http\Controllers\MeowController::class, 'getCatVideo']);
谁能帮我得到 那个 确切的整数参数,或者如果参数不完全是给定的参数则阻止路由工作?
提前致谢。
默认需要参数。
验证参数:
Route::get('/videos/cats/{race_id}/{cat_id}, [App\Http\Controllers\MeowController::class, 'getCatVideo'])
->where('race_id', '\d+')
->where('cat_id', '\d+');
有用link:https://laravel.com/docs/8.x/routing#parameters-regular-expression-constraints