Zend framework 如何在Zend Framework路由中使用扩展

Zend framework 如何在Zend Framework路由中使用扩展,zend-framework,frameworks,routing,zend-route,Zend Framework,Frameworks,Routing,Zend Route,我想在我的URL中使用像.htm这样的扩展名。有没有办法做到这一点 我定义了以下规则: frontend.route = '/:standort/:id' 当我使用下面的 frontend.route = '/:standort/:id.htm' 然后变量的名称是id.htm,类似于$params[“id.htm”]。 如何告诉Zend框架使用什么作为变量 问候 //编辑 我的完整配置现在如下所示: frontend.type = 'Zend_Controller_Router_Route_

我想在我的URL中使用像.htm这样的扩展名。有没有办法做到这一点

我定义了以下规则:

frontend.route = '/:standort/:id'
当我使用下面的

frontend.route = '/:standort/:id.htm'
然后变量的名称是id.htm,类似于$params[“id.htm”]。 如何告诉Zend框架使用什么作为变量

问候

//编辑

我的完整配置现在如下所示:

frontend.type = 'Zend_Controller_Router_Route_Regex'
frontend.route = '/(.?)/(\w+?\.htm)'
frontend.defaults.module = 'frontend'
frontend.defaults.controller = 'index'
frontend.defaults.action = 'index'
frontend.defaults.standort = 'national'
frontend.map.1 = 'standort'
frontend.map.2 = 'id'
这就是我加载配置的方式

$file = APPLICATION_PATH . '/modules/' . $module . '/configs/routing.ini';

        if(Zend_Loader::isReadable($file)){
            $config = new Zend_Config_Ini($file);
            $router = Zend_Controller_Front::getInstance()->getRouter();
            $router->addConfig($config);
        }         

您可以使用正则表达式路由执行此操作:

frontend.type = "Zend_Controller_Router_Route_Regex"
frontend.route = '/(.?)/(\w+?\.htm)'
frontend.map.1 = "standort"
frontend.map.2 = "id"

但是,除非您试图保留现有的URL结构,否则我将不使用.htm,因为它没有任何用途。

谢谢,但这不起作用。使用标准路由,即使getRoutes()返回正确的配置,而旧的配置被覆盖。您能提供更多信息吗?当你说“不接受”时,你是不是有错误?您的完整配置文件是什么样子的?您是如何加载这些路由的?