Zend url:get参数始终停留在url中 [英] Zend url : get parameter always stay in the url

查看:87
本文介绍了Zend url:get参数始终停留在url中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用带参数的Zend url助手时遇到了一些麻烦。
在视图中,我有分页发送额外的参数(所以在URL中),所以没关系。但是这并不好,即使我改变了页面,这些参数也总是留在url中。
事实上,zend url helper - 我用来生成链接或表单的动作url - 在url结尾添加automaticaly参数,所以无论我点击哪个链接,我都有这个参数... p>

  //在我的控制器中
$ this-> _view-> url(array(action=> action-name);
//生成例如:mywebsite / controller-name / action-name / pays / 4但我不希望/ pays / 4

感谢您的协助

解决方案

url 方法接受附加参数,其中一个参数重置 get-string 参数。


url(


array $ urlOptions = array(),

$ name = null,

$ reset = false,

$ encode = true



生成一个给定名称的url



参数:

<数组> $ urlOptions - Opt离子传递给Route对象的组装方法。

mixed $ name - 要使用的路径的名称。如果为null,它将使用当前的路由

bool $ reset - 是否重置路由默认值与所提供的路径



返回:
字符串Url为链接href属性。

全部在文档中。以上是ZF版本1.10


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"

Thank you for your help

解决方案

The url method accepts additional parameters. One of them resets the get-string parameters.

url (

array $ urlOptions = array(),
$ name = null,
$ reset = false,
$ encode = true
)
Generates an url given the name of a route.

Parameters:

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

Returns: string Url for the link href attribute.

It's all in the doc. The above is for ZF version 1.10

这篇关于Zend url:get参数始终停留在url中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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