The question is resolved in the comments, but I still write the answer, because it may be useful to someone else.
The Url::to() method can take as a first parameter either a string with a route, or an array, in which the first element will be the same string with a route, and the remaining elements will be query parameters in the key-> value format.
Those. The correct call will look like this:
Url::to([ 'catalog', 'gender' => 2, 'cat_id' => 1 ]);
This construct should give the url of the form /catatolg?gender=2&cat_id=1 .
In the question, call parameters look at the following way * :
Url::to([ // не нужно в конце писать `/` 0 => 'catalog/', // параметр - массив 1 => [ 'gender' => 2, 'cat_id' => 1 ] ]);
What does the url look like: /catalog?' . urlencode('1[gender]=2&1[cat_id]=1') /catalog?' . urlencode('1[gender]=2&1[cat_id]=1')
* considering that in PHP all arrays are actually associative, it’s just that when the keys are not explicitly indicated, then the keys are implied indices are 0, 1, 2 ...
Url::to(['catalog/', 'param1' => 'value1', 'param2' => 'value2']).... judging by yiiframework.com/doc-2.0/guide-helper-url.html#creating-urls ........ i.e.'param1' => 'value1', 'param2' => 'value2'is not an embedded array, this is the key of the current array's value - Alexey Shimanskyphpfunction array_merge$url = ['catalog/']; $params = ['gender' => 2, 'cat_id' => 1]; Url::to(array_merge($url, $params));$url = ['catalog/']; $params = ['gender' => 2, 'cat_id' => 1]; Url::to(array_merge($url, $params));orUrl::to(array_merge(['catalog/'], $params));- Alexey Shimansky