为什么route函数在路由分组中不能正确返回URL
为什么route函数在路由分组中不能正确返回URL
- 感谢大家答疑解惑,问题如下:
- 访问localhost:8000/user/comments/66 时提示:
- 代码如下:
Route::group(["as"=>"user", "prefix"=>"user"], function(){ Route::group(["as"=>"comments", "prefix"=>"comments"], function(){ Route::get("{id}", [ "as"=> "show", "uses"=>function ($id){ // 访问:http://localhost:8000/user/comments/66 为什么报错?,找不到路由? $request_uri = route("show", [999]); return "ID Number is: {$id}, URL: {$request_uri}"; } ]); }); });
推荐文章: