doulin1867
2017-10-22 21:47
浏览 912
已采纳

Laravel:从控制器重定向到特定的URL

I'm having troubles to just redirect to a url from a controller.

This is my trigger:

<form method="POST" action="{{ url('creategroup") }}">

Then, this is the catcher:

Route::post('/creategroup', 'GroupController@store');

And finally, this is my method:

public function store(Request $request) {
    /* bla bla bla */
    return Redirect::to('/users/'.$request->id.'/groups/');
}

But it doesn't work, the url just stops in localhost/creategroup and it shows a page that say that the page has expired, and it doesn't redirect to any place. Help please.

图片转代码服务由CSDN问答提供 功能建议

我遇到了从控制器重定向到网址的麻烦。 < p>这是我的触发器:

 &lt; form method =“POST”action =“{{url('creategroup”)}}“&gt; 
   
 
 

然后,这是捕手:

  Route :: post('/ creategroup','GroupController @ store');  
   
 
 

最后,这是我的方法:

 公共函数存储(请求$请求){
  / * bla bla bla * / 
返回Redirect :: to('/ users /'.$ request-&gt; id。'/ groups /'); 
} 
   
  
 

但它不起作用,url只是在localhost / creategroup中停止,它显示一个页面说明页面已过期,并且它没有重定向到任何地方。请帮助。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题