这个 Laravel 路由语句到底是什么意思?

What does this Laravel route statement exactly mean?

我是 Laravel 的新手,正在探索现有的项目代码。在路由中,我发现了下面的表达式:

Route::get('/', ['as' => 'index', 'uses' => 'SomeController@someMethod']);

有人可以澄清这个表达式数组的第二个参数 - ['as' => 'index', 'uses' => 'SomeController@someMethod']?

我没能在官方文档中找到它的描述:https://laravel.com/docs/5.5/routing

as 是一个 route name。您可以使用它与 route() 助手建立链接。

uses是一个动作。它是将要执行的控制器和方法。

你可以在old docs中看到一个例子:

Route::get('user/profile', [
    'as' => 'profile', 'uses' => 'UserController@showProfile'
]);

'as' 部分用于 "naming the route",因此您可以通过名称访问路由。 Laravel Documentation.

'uses' 部分说 "use the someMethod method in SomeController" 并执行该方法中的任何操作。