Laravel 4:重定向到给定的网址

2022-01-08 00:00:00 php laravel laravel-4

在 laravel 的 Redirect 类中是否有参数是完整 url 的方法?我们都知道这些方法的参数只是路由名称、动作、斜杠等,但我现在想要的是

Is there a method in Redirect class of laravel where the parameter is a complete url? We all know parameters to these methods are just route name,action, slash,..etc but what I want now is like

return Redirect::foo('https://bla.com/?yken=KuQxIVTNRctA69VAL6lYMRo0');

推荐答案

是的

use IlluminateSupportFacadesRedirect;

return Redirect::to('http://heera.it');

查看文档.

更新: Redirect::away('url')(对于外部链接,Laravel 4.19 版):

Update: Redirect::away('url') (For external link, Laravel Version 4.19):

public function away($path, $status = 302, $headers = array())
{
    return $this->createRedirect($path, $status, $headers);
}

相关文章