Zend Framework URL - 如何传递查询字符串? [英] Zend Framework URL - How to pass a query string?

查看:20
本文介绍了Zend Framework URL - 如何传递查询字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个链接:

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

有了这个,我得到了类似的东西:

With this I get something like:

http://foo.com/form

我需要通过此链接将参数传递给 URL.这样我就可以拥有这样的东西:

I need to pass a param to the URL with this link. So that I can have something like this instead:

http://foo.com/form?bar=1231

我们如何才能做到这一点?

How can we accomplish this ?

提前致谢.

推荐答案

URL 视图帮助器用于使用应用程序的路由设置来创建链接.如果您没有遵循路由设置,那么使用视图助手没有多大意义,相反您可以将您从视图助手中获得的创建 url 附加到 ?bar=1231.

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>

这篇关于Zend Framework URL - 如何传递查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆