Zend url:get参数始终停留在url中

编程入门 行业动态 更新时间:2024-10-28 20:27:51
本文介绍了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中

本文发布于:2023-11-02 05:23:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551489.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:停留在   参数   Zend   url

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!