Laravel

route设置###

//get写法 as 别名,可以用这获取这条路有的详细信息
Route::get('/', 'SsoTestController@hello');
Route::get('user/profile', [
    'as' => 'profile', 'uses' => 'UserController@showProfile'
]);
//post写法 

//group写法,为了给一个集合的路径加上指定的 ‘中间器’
$app->group(['middleware' => 'foo|bar'], function($app)
{
    $app->get('/', function() {
        // Uses Foo & Bar Middleware
    });

    $app->get('user/profile', function() {
        // Uses Foo & Bar Middleware
    });
});

获取route路径###

$url = route('profile');

重定向###

$redirect = redirect()->route('profile');

原文地址:https://www.cnblogs.com/canbefree/p/5238098.html