Generating url relative to the base url in laravel 4

后端 未结 2 1897
名媛妹妹
名媛妹妹 2021-02-20 16:42

I\'m new to Laravel & right now building one application on L-4 but got stuck at one place. Can\'t able to understand how to generate url relative to base url. In laravel-3

2条回答
  •  走了就别回头了
    2021-02-20 17:19

    To generate a relative URL, you can use URL::route or URL::action as they allow to pass a $absolute parameter which defaults to true. So to get a relative URL when using named routes for example, you can use the following:

    URL::route('foobar', array(), false)
    

    This will generate a URL like /foobar.

提交回复
热议问题