Zend url : get 参数始终保留在 url 中 [英] Zend url : get parameter always stay in the url
问题描述
我在使用带有 get 参数的 Zend url helper 时遇到了一些问题.在一个视图中,我有分页,它在 get 中发送额外的参数(所以在 url 中),所以没关系.但这不好的是,即使我更改页面,参数也始终保留在 url 中.事实上,zend url helper - 我用来生成链接的 url 或表单的动作 - 在 url 的末尾自动添加参数,所以无论我点击什么链接,我都有这个参数...
I have some trouble using the Zend url helper with get parameter. In a view, I have pagination which send extra parameters in get (so in the url), so that's ok. But that is not ok is that the parameters always stay in the url even if I change page. In fact, the zend url helper - I use to generate the url of link or form's action - add automaticaly the parameter at the end of the url so whatever the link I click, I have this parameters...
//In my controller
$this->_view->url(array("action"=>"action-name");
// generate for example : "mywebsite/controller-name/action-name/pays/4" but I don't want the "/pays/4"
感谢您的帮助
推荐答案
url
方法接受额外的参数.其中之一重置 get-string
参数.
The url
method accepts additional parameters. One of them resets the get-string
parameters.
网址(
数组 $ urlOptions = 数组(),
$名称=空,
$重置=假,
$ 编码 = 真
)
生成一个给定路由名称的 url.
array $ urlOptions = array(),
$ name = null,
$ reset = false,
$ encode = true
)
Generates an url given the name of a route.
参数:
array $urlOptions - 传递给 Route 对象的 assemble 方法的选项.
混合 $name - 要使用的路由的名称.如果为 null,它将使用当前的 Route
bool $reset - 是否使用提供的路由默认值重置
array $urlOptions - Options passed to the assemble method of the Route object.
mixed $name - The name of a Route to use. If null it will use the current Route
bool $reset - Whether or not to reset the route defaults with those provided
返回:链接 href 属性的字符串 URL.
Returns: string Url for the link href attribute.
一切都在文档中.以上适用于 ZF 1.10 版
It's all in the doc. The above is for ZF version 1.10
这篇关于Zend url : get 参数始终保留在 url 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!