2016-03-12 52 views
-1

我使用本地laravel 5對窗口..我正在嘗試的頁面重定向到一些外部url..but似乎沒有任何幫助我..如何重定向到laravel URL 5.0

我試圖

    return \Response::make('',302)->header('Location','http://site2'); 
        return redirect()->away("http://site2"); 

        \Redirect::to('http://site2'); 
        header('Location: http://site2'); 

但他們沒有working..gives沒有反應..

+0

調查結果: 重定向到外部URL的核心php函數 return header('Location:http://someurl.com'); 不在laravel內工作.. :) –

回答

0

事情是這樣的:

return redirect()->away('http://site2'); 

確保你還添加了返回(即return $this->checkSession();start()

+0

return redirect() - > away(「http:// site2」);在routes.php中工作正常,但不能在控制器中工作 –

+0

您是否檢查過「確保您還在start()中添加了返回值(即返回$ this-> checkSession();)」。 – Drudge

+0

對不起,我無法理解這一點。 我的代碼是 return redirect() - > away(「http:// site2」); –