As presented in zend controller's documentation page you can retrieve parameters like this:
public function userinfoAction()
{
$request = $this->getRequest();
$username = $request->getParam('username');
$username = $this->_getParam('username');
}
You should also note that request documentation states:
In order to do some of its work, getParam()
actually retrieves from several sources. In order of priority, these include: user parameters set via setParam()
, GET
parameters, and finally POST
parameters. Be aware of this when pulling data via this method.
If you wish to pull only from parameters you set via setParam()
, use the getUserParam()
.
Additionally, as of 1.5.0, you can lock down which parameter sources will be searched. setParamSources()
allows you to specify an empty array or an array with one or more of the values '_GET' or '_POST' indicating which parameter sources are allowed (by default, both are allowed); if you wish to restrict access to only '_GET' specify setParamSources(array('_GET'))
.