使用网址视图帮助程序链接时从URL中删除参数 [英] Removing parameters from URL when using Url view helper links

查看:80
本文介绍了使用网址视图帮助程序链接时从URL中删除参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用"URL视图"帮助器构建链接时,如果当前页面的URL中包含参数,则"URL视图"帮助器生成的URL也将包含参数.

When using the Url view helper to build links, if the current page has parameters in the url, the url generated by the Url view helper will contains parameters as well.

例如,在页面/controller/action/param/value/中,以下代码:

For instance in the page /controller/action/param/value/ the following code:

<a href="<?php echo $this->url(array(
    'controller' => 'index',
    'action' => 'index'
)) ?>">Dashboard</a>

将输出:

<a href="/index/index/param/value/">Dashboard</a>

是否可以清除参数助手输出的网址?

Is it possible to clean the url outputted by the helper of parameters?

推荐答案

我认为帮助程序的第三个参数将清除默认参数,例如

I think the third parameter to the helper will clear the default params, e.g.

<a href="<?php echo $this->url(array(
    'controller' => 'index',
    'action' => 'index'
), null, true) ?>">Dashboard</a>

文档: http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial

这篇关于使用网址视图帮助程序链接时从URL中删除参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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