//响应重定向 |
Route::get( 'example/test24' , function (){ |
return Redirect::to( 'example/test21' )->with( 'username' , 'xiaoming' ); |
}); |
//带上数据的重定向 |
Route::get( 'example/test25' , function (){ |
//with 方法将数据写到了Session中,通过Session::get 方法即可获取该数据。 |
return Redirect::to( 'example/test21' )->with( 'username' , 'xiaoming' ); |
}); |
//重定向至命名路由 |
return Redirect::route( 'login' ); |
//重定向值带有命名参数的命名路由 |
return Redirect::route( 'profile' , array ( 'user' => 1)); |
//重定向至指定的控制器方法 |
return Redirect::action( 'HomeController@index' ); |
//重定向至指定的控制器方法,并可带上参数 |
return Redirect::action( 'UserController@profile' , array ( 'user' => 1)); |