Zend Framework URL - How to pass a query string?

不想你离开。 提交于 2019-12-07 07:37:39

The URL view helper is used to create links using the Routes setup with your application. If you aren't following the routes setup, then there isn't much point in using the view helper, and instead you could just append the created url you got from the view helper with the ?bar=1231.

<a href="<?php echo $this->url(array('controller'=>'index','action'=>'form'),NULL,TRUE)."?bar=1231";?>">
                                    Form
</a>

In ZF, URL parameters are passed as /param-name/param-value. So if http://foo.com/form/bar/1231 would satisfy you, you could do like this:

<?php echo $this->url(array('controller'=>'index','action'=>'form', 'bar'=>'1231'),NULL,TRUE);?>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!