Orv*_*vyl 37 php laravel laravel-4
是否在Redirect类的laravel中有一个方法,其中参数是一个完整的URL?我们都知道这些方法的参数只是路由名称,动作,斜线,等等,但我现在想要的是
return Redirect::foo('https://bla.com/?yken=KuQxIVTNRctA69VAL6lYMRo0');
Run Code Online (Sandbox Code Playgroud)
The*_*pha 67
是的,它就是
return Redirect::to('http://heera.it');
Run Code Online (Sandbox Code Playgroud)
更新:( Redirect::away('url')对于外部链接,Laravel版本4.19):
public function away($path, $status = 302, $headers = array())
{
return $this->createRedirect($path, $status, $headers);
}
Run Code Online (Sandbox Code Playgroud)
小智 10
您可以在 Laravel 中使用不同类型的重定向方法 -
return redirect()->intended('http://heera.it');
Run Code Online (Sandbox Code Playgroud)
或者
return redirect()->to('http://heera.it');
Run Code Online (Sandbox Code Playgroud)
或者
use Illuminate\Support\Facades\Redirect;
return Redirect::to('/')->with(['type' => 'error','message' => 'Your message'])->withInput(Input::except('password'));
Run Code Online (Sandbox Code Playgroud)
或者
return redirect('/')->with(Auth::logout());
Run Code Online (Sandbox Code Playgroud)
或者
return redirect()->route('user.profile', ['step' => $step, 'id' => $id]);
Run Code Online (Sandbox Code Playgroud)
小智 6
您还可以使用redirect()这样的方法:-
return redirect('https://stackoverflow.com/');
Run Code Online (Sandbox Code Playgroud)