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

后端 未结 3 1448
误落风尘
误落风尘 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 14:47

    Since version 2.1.4 you come across user error

    Query route deprecated as of ZF 2.1.4; use the "query" option of the HTTP router\'s assembling method instead

    Usage example:

    $name    = 'index/article';
    $params  = ['article_id' => $articleId];
    $options = [
            'query' => ['param' => 'value'], 
        ];
    $this->url($name, $params, $options);
    

提交回复
热议问题