合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
# 命名路由 命名路由让你更方便于产生 URL 与重定向特定路由。您可以用 as 的数组键值指定名称给路由: ``` Route::get('user/profile', ['as' => 'profile', function() { // }]); ``` 也可以为控制器动作指定路由名称: ``` Route::get('user/profile', [ 'as' => 'profile', 'uses' => 'UserController@showProfile' ]); ``` 现在你可以使用路由名称产生 URL 或进行重定向: ``` $url = route('profile'); $redirect = redirect()->route('profile'); currentRouteName 方法会返回目前请求的路由名称: $name = Route::currentRouteName(); ```