阅读(3810) (0)

Laravel 8 访问当前路由

2021-06-23 17:35:01 更新

您可以使用 Route 门面的 currentcurrentRouteNamecurrentRouteAction 方法处理传入的请求路由访问信息:

$route = Route::current();

$name = Route::currentRouteName();

$action = Route::currentRouteAction(); 

有关 Route 门面Route 实例 的基础类的信息,请参阅 API 文档,以查看所有可访问的方法。