获取 Laravel 路由 name

获取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();
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!