[PHP] Laravel重定向 →→→→→进入此内容的聊天室

来自 , 2020-01-14, 写在 PHP, 查看 139 次.
URL http://www.code666.cn/view/ec47a5de
  1. //响应重定向
  2. Route::get('example/test24', function(){
  3.     return Redirect::to('example/test21')->with('username', 'xiaoming');
  4. });
  5.  
  6. //带上数据的重定向
  7. Route::get('example/test25', function(){
  8.     //with 方法将数据写到了Session中,通过Session::get 方法即可获取该数据。
  9.     return Redirect::to('example/test21')->with('username', 'xiaoming');
  10. });
  11.  
  12. //重定向至命名路由
  13. return Redirect::route('login');
  14.  
  15. //重定向值带有命名参数的命名路由
  16. return Redirect::route('profile', array('user' => 1));
  17.  
  18. //重定向至指定的控制器方法
  19. return Redirect::action('HomeController@index');
  20.  
  21. //重定向至指定的控制器方法,并可带上参数
  22. return Redirect::action('UserController@profile', array('user' => 1));

回复 "Laravel重定向"

这儿你可以回复上面这条便签

captcha