Rod*_*uza 1 php zend-framework zend-framework-routing
我正在使用Zend Framework和URL View Helper来创建URL
我的导航中有一些这样的行:
$this->url(array('controller' => 'index', 'action' => 'index'))
$this->url(array('controller' => 'who', 'action' => 'view', 'id' => $row->who_id));
$this->url(array('controller' => 'projects', 'action' => 'view', 'id' => $row->mai_id));
$this->url(array('controller' => 'content', 'action' => 'view', 'type' => 'theater', 'id' => $row->the_id));
$this->url(array('controller' => 'shows', 'action' => 'view'));
Run Code Online (Sandbox Code Playgroud)
这样,首先,我有一些像这样的URL
http://ccgss.local/information/location
http://ccgss.local/who/view/id/1
Run Code Online (Sandbox Code Playgroud)
但是当我访问具有更多参数的另一个链接时,http://ccgss.local/content/view/id/1/type/theater
它会混淆仍然存在的参数:http://ccgss.local/who/view/id/1/type/theater
我的意思是,当我访问另一个页面时,参数不会清理.
我该如何解决?
小智 5
调用urlhelper 时需要重置参数.
$ this-> url(array('controller'=>'index','action'=>'index'),null,true);
第二个参数是要使用的路由的名称.null如果您想使用当前路线,请保留它.
第三个参数指示是否重置参数.这是false默认情况.所以,只需将其设置true为去除现有参数.