使用Url视图助手链接时从URL中删除参数

met*_*rso 7 zend-framework view-helpers

使用Url视图助手构建链接时,如果当前页面在url中包含参数,则Url视图助手生成的url也将包含参数.

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

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

将输出:

<a href="/index/index/param/value/">Dashboard</a>
Run Code Online (Sandbox Code Playgroud)

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

Dav*_*unt 21

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

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

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