0

我有这个设置:

    application
    ---admin
    -----controllers
    -------IndexController.php
    ---public
    -----controllers
    ---modules
    -----users
    -------controllers
    -----pages
    -------controllers

我想要这条路线:

www.domain.com/admin/modulename/controller/action/

或者如果模块不存在我使用管理控制器

www.domain.com/admin/controller/action/

有什么建议吗?

谢谢

4

1 回答 1

0

在您的引导文件中编写以下代码:

$router = Zend_Controller_Front::getInstance()->getRouter();
if($moduleName){
$route = new Zend_Controller_Router_Route(
                  ':module/:controller/:action/',
                  array(
                      'controller' => $ControllerName,
                      'module' => '$moduleName',
                      'action'     => $ActionName
                  )
              );
}else{
$route = new Zend_Controller_Router_Route(
                  ':controller/:action/',
                  array(
                      'controller' => $ControllerName,
                      'action'     => $ActionName
                  )
              );
}

$router->addRoute('default', $route);
于 2012-06-01T12:39:47.810 回答