【发布时间】:2021-11-11 14:23:40
【问题描述】:
我的路线如下所示:
Route::namespace('Api\HelpGuides')->prefix('help')->group(function () {
Route::get('/{userInput}', 'FetchArticlesController')
->where('userInput', '.*');
});
而控制器看起来像这样:
public function __invoke(Request $request, string $userInput) ...
我希望能够捕获 $userInput 所以如果我收到来自前端的请求,如下所示:
/api/help/anything/could/be/in/here?including=params
我可以在 FetchArticlesController 中使用。
当我在控制器中转储 $userInput 时,我得到了查询字符串的所有内容,因此在上面的示例中,它转储了
/anything/could/be/in/here
有没有办法让它在我定义的路线之后倾倒所有东西?例如/api/help/ 之后的任何内容?理想情况下,我希望 $userInput 字符串看起来像:
/anything/could/be/in/here?including=params
【问题讨论】: