We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Correct way to get multiple values for same parameter name in GET request


I am trying to send multiple values for the same parameter name in a GET request like this:


In my controller, I get the parameters with the following code:

$params = $this->request->getQuery();

And I obtain this:

array(2) { ["_url"]=> string(7) "/module" ["p"]=> string(6) "value2" }

So I guess that the getQuery function retrieves only the last value defined in the query.

Is there a simple way to retrieve an array of these values via Phalcon or do I have to change the format of my query and split it?


I have found the answer to my question.

I modified my GET request like this:


Now, I get this:

array(2) { ["_url"]=> string(7) "/module" ["p"]=> array(2) { [0]=> string(6) "value1" [1]=> string(6) "value2" } }