I'm attempting to create a url with a query string using a route, like so:
$this->url('users') -> /users
$this->url('users', ['sort' => 'desc']) -> /users?sort=desc
However this doesn't seem to work (the second helper actually outputs /users
). According to this unofficial, out-of-date documentation there was once a way to do this by appending /query
to the route name, however this gives a route-not-found exception.
Can this be done using the current url helper?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…