Home > Article > PHP Framework > About the role of @ in laravel routing configuration
Controller action mode
URL::action('LoginController@index')
This method automatically generates the uri mapped to the controller method based on the 'uses' parameter when registering the route
Route::controller('login','LoginController');
The result is similar to:
Route::get('login',['uses'=>'LoginController@getIndex']); Route::get('login/edit',['uses'=>'LoginController@getEdit']); Route::post('login/edit',['uses'=>'LoginController@postEdit']);
There is no difference between the two writing methods. uses is often used with as to specify the routing name for the controller action
Route::get('user/login', [ 'as' => 'login', 'uses' => 'LoginController@getIndex' ]); return redirect()->route('login');
Recommended: laravel tutorial
The above is the detailed content of About the role of @ in laravel routing configuration. For more information, please follow other related articles on the PHP Chinese website!