Redirect to external URL with return in laravel

后端 未结 8 1433
野的像风
野的像风 2021-02-01 13:41

I am trying to send one time password to a user using SMS INDIA HUB API. For that purpose I need to redirect to a URL format:

http://cloud.smsindiahub.in/vendorsms/pushs

相关标签:
8条回答
  • 2021-02-01 14:17

    For Laravel 5.x we can redirect with just

    return redirect()->to($url);
    
    0 讨论(0)
  • 2021-02-01 14:17

    Also, adding class

          use Illuminate\Http\RedirectResponse;
    

    and after, like this:

     public function show($id){
    
        $link = Link::findOrFail($id);  // get data from db table Links
    
        return new RedirectResponse($link->url);  // and this my external link, 
     }
    

    or -

     return  new RedirectResponse("http://www.google.com?andParams=yourParams"); 
    

    For external links have to be used full URL string with 'http' in begin.

    0 讨论(0)
提交回复
热议问题