獲取laravel的路由name,兩種方式
use Illuminate\Support\Facades\Route;
$route = Route::current();
$name = Route::currentRouteName();
$action = Route::currentRouteAction();
二 自帶函式
request()->route()->getName();
$request = app('request')->create('https://learnku.com/laravel/wikis/26002');
$route = app('router')->getRoutes()->match($request);
$route->getName(); $route->getAction(); $route->parameters();
本作品採用《CC 協議》,轉載必須註明作者和本文連結