How can you add query parameters in the ZF2 / ZF3 url view helper

后端 未结 3 1439
误落风尘
误落风尘 2020-12-01 14:11

I\'m attempting to create a url with a query string using a route, like so:

$this->url(\'users\') -> /users
$this->url(\'users\', [\'sort\' => \'         


        
3条回答
  •  暖寄归人
    2020-12-01 15:07

    This can be done using the current URL view helper yes.

    $this->url('users', [], array('query' => array('sort' => 'desc')))
    

    You do not need to have query string child routes setup. As long as you have a route setup for 'users', you can just look for the 'sort' param in your controller and use where required.

提交回复
热议问题