We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to get url parameter in controller

https://www.example.com/api/test?a=1&b=2

I want to get the value of a, b in testAction of ApiController, I tried this:

$a = $this->request->get('a'); and $a = $this->request->getQuery('a');

It's not working. I searched and peaples say using getQuery should work, but, .... I need help....

Does it have a relationship with nginx config? Thanks



58.4k

Hi

You try die after the code abobe, such that

$a = $this->request->get('a'); 
$b = $this->request->getQuery('a');
var_dump($a);
var_dump($b);
die();