web
路由设置
Route::group(['prefix' => '/admin', 'as' => 'admin.'], function() {
Route::group(['prefix' => '/public', 'as' => 'public.'], function() {
Route::get('', 'TestController@index');
}
}
获得的路由 / uri
信息
$request->decodedPath(); //反回的是路径即uri:admin/public
$request->route()->getName(); //反回的是路由别名:admin.public.index
$request->path(); //反回的是路径即uri:admin/public
$route = Route::getFacadeRoot()->current()->uri(); //反回的是路径即uri:admin/public
Route::currentRouteName(); //反回的是路由别名:admin.public.index
Route::getCurrentRoute()->getActionName(); //返回完整的Action字符:App\Http\Controllers\Manage\PublicController@index
request()->route()->getActionMethod(); //返回: index
$request->route()->getName(); //反回的是路由别名:admin.public.index
request()->route()->getName(); //反回的是路由别名:admin.public.index