Laravel 路由:获取当前路由 Draft 1 个改进

访问当前路由

你可以使用 Route facade 上的 current 、 currentRouteName 和 currentRouteAction 方法来访问处理传入请求的路由的信息:

$route = Route::current();

$name = Route::currentRouteName();

$action = Route::currentRouteAction();

如果你想知道所有可访问的方法,可以查看 API 文档,了解 Route facadeRoute 实例 的基础类。

本 Wiki 尚未完善,邀您参与 如何撰写一篇高品质的 Wiki?
讨论数量: 3
elesos

继续写起啊

4年前 评论

$name = Route::currentRouteName();始终是空的

1年前 评论
JeffDean 1年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!