ZF2: Zend Framework 2 Full URL including host name

后端 未结 4 806
一生所求
一生所求 2021-02-02 00:32

In my view I need to draw full URL. Like this:

http://hostename.com/default/url

When I try to use $this->url(\'default\', array(1,2,3)

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 00:46

    You can use the option force_canonical on the router. All router options go into the third parameter of the url helper:

    url($route, $params, $options)
    

    So you can so something like this:

    $this->url('myroute', array('id' => 123), array('force_canonical' => true))
    

提交回复
热议问题