I am using ZF2 modules, but I am not using full ZF2 framework stack.
I need to be able to pull GET
parameters from URL string into my Controller.
I've created a Controller
that extends AbstractActionController
of ZF2. After reading ZF2: Get url parameters in controller, I have used print $this->params('line');
to try to print $_GET['line']
value, but nothing shows up.
In short, this is supposed to work, but doesn't:
//ZF2 equivalents of print $_GET['line'] (either one should work)
print $this->params('line');
print $this->getEvent()->getRouteMatch()->getParam('line');
I imagine it is due to lack of mechanism to populate params
from $_GET
. How can I get that part of ZF2 mechanism into my code?
And is it worth the trouble? For example, if I need to introduce routes, events, and pretty much bring the entire ZF2 framework into my code, and significantly rewire my app for this to work, I might want to just stick to $_GET
method, at least for now.