【发布时间】:2012-09-08 22:49:47
【问题描述】:
路由中的多控制器如何工作? 我的路线:
$router->addRoute(
'index',
new Zend_Controller_Router_Route('/:lang/:@action',
array(
'lang' => 'en',
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
)
);
此路由适用于索引控制器,但不适用于身份验证控制器。 如何使用该路由和索引身份验证控制器?
我的菜单项:
$this->url(array('controller'=>'Auth','action'=>'index')
这个菜单项,不起作用。 我的完整函数_initRoutes()
protected function _initRoutes(){
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->removeDefaultRoutes();
$router->addRoute(
'fullRoute',
new Zend_Controller_Router_Route('/:lang/:module/:controller/:action',
array('lang' => ':lang')
)
);
$router->addRoute(
'languageControllerAction',
new Zend_Controller_Router_Route('/:lang/:controller/:action',
array('lang' => ':lang')
)
);
$router->addRoute(
'index',
new Zend_Controller_Router_Route('/:lang/:@action',
array(
'lang' => 'en',
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
)
);
}
我需要控制器身份验证的路由。
【问题讨论】:
-
你想要
IndexController的一条路由和AuthController的第二条路由吗?
标签: zend-framework frameworks controller router