zend framework $ this-> url无法正常工作

时间:2013-12-09 14:02:46

标签: php zend-framework

我有一个链接去更新屏幕,在更新屏幕上有一个后退按钮来加载索引。

当我点击帖子时,

* 当前网址为* http://sample.com/demoZend/public/index/,我将其转到此网址http://sample.com/demoZend/public/index/update/id/1

现在此视图中有一个按钮可以返回索引

<?php
$this->title = "Update post";
$this->headTitle('Update Post');

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

问题是,当点击后退按钮时,它会转到http://sample.com/demoZend/public/index/index/id/1而不是http://sample.com/demoZend/public/index/index/

此参数ID仍然存在。 id / 1 如何删除此参数并使网址公开/索引/索引/

我是zend框架的新手。所以对于使用zend的人来说,这一定是件小事。

1 个答案:

答案 0 :(得分:1)

使用Url Helper上的重置参数重置所有参数

function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true)

echo $this->url(array('controller'=>'index', 'action'=>'index'), null, true);