ZF2: Get url parameters in controller

独自空忆成欢 提交于 2019-11-28 05:22:11

From here:

$slug = $this->getEvent()->getRouteMatch()->getParam('slug');

More documentation here, but it looks kind of incomplete.

Or simply:

$slug= $this->params('slug');

Why not this one:

$this->params()->fromRoute('slug');

you can simply use this as well

$this->params()->fromQuery('slug',null);
$this->params()->fromPost('slug',null);

I hope it works...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!