首先,我想这样做,当用户导航到 test.com/username 时,它会将他带到 test.com/account/profile/name/username,所以我添加了这条路线
$fc = Zend_Controller_Front::getInstance();
$router = $fc->getRouter();
$route = new Zend_Controller_Router_Route(
':name',
array('controller' => 'account', 'action' => 'profile'));
$router->addRoute('profile',$route);
它使它起作用了,但是现在当我使用以下链接时
<a href="<?php echo $this->url(array(
'controller' =>'account',
'action'=>'update'), 'default',true);?>">Settings</a>
我猜它会“混淆”并使用上述路线,因为它不会去 test.com/account/update..
我是否必须为更新操作添加另一条路线?这是否意味着我必须为与帐户控制器关联的所有操作添加新路由?
这里有什么帮助吗?:)
编辑:问题是链接重定向到 test.com/account/update,但它认为“帐户”是上面路由中定义的参数(如 test.com/name),而不是控制器因此它将其重定向到“配置文件”操作。