Laravel 4: Redirect to a given url

后端 未结 5 1277
一生所求
一生所求 2020-12-25 10:28

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 wha

5条回答
  •  庸人自扰
    2020-12-25 10:51

    Yes, it's

    use Illuminate\Support\Facades\Redirect;
    
    return Redirect::to('http://heera.it');
    

    Check the documentation.

    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);
    }
    

提交回复
热议问题