Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zend路由器配置xml,快捷方式?_Xml_Config_Router_Zend Route - Fatal编程技术网

Zend路由器配置xml,快捷方式?

Zend路由器配置xml,快捷方式?,xml,config,router,zend-route,Xml,Config,Router,Zend Route,我有一个这样的xml <configdata> <routes> <home type="Zend_Controller_Router_Route"> <route>home</route> <defaults> <controller>index</controller>

我有一个这样的xml

<configdata>
    <routes>
        <home type="Zend_Controller_Router_Route">
            <route>home</route>
            <defaults>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </home>
    </routes>
</configdata>

如何在配置xml中执行此操作?

在bootsrap.php上

protected function _initRoutes()
 {
  $routefile = new Zend_Config_Xml(APPLICATION_PATH.'/routes.xml');
  $router = Zend_Controller_Front::getInstance()->getRouter();
  $router->addConfig($routefile);
  return $router;
 }
其中routes.xml文件是包含所有路由的xml文件,它必须位于应用程序文件夹中

protected function _initRoutes()
 {
  $routefile = new Zend_Config_Xml(APPLICATION_PATH.'/routes.xml');
  $router = Zend_Controller_Front::getInstance()->getRouter();
  $router->addConfig($routefile);
  return $router;
 }