Laravel 4: Redirect to a given url

后端 未结 5 1309
一生所求
一生所求 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:55

    Both Redirect::to() and Redirect::away() should work.

    Difference

    Redirect::to() does additional URL checks and generations. Those additional steps are done in Illuminate\Routing\UrlGenerator and do the following, if the passed URL is not a fully valid URL (even with protocol):

    Determines if URL is secure
    rawurlencode() the URL
    trim() URL
    

    src : https://medium.com/@zwacky/laravel-redirect-to-vs-redirect-away-dd875579951f

提交回复
热议问题