一个zend框架路由问题

时间:2011-06-02 04:52:50

标签: zend-framework

我想将我的网址/resolution/index/res/1024x768发送到/resolution/1024x768 application.ini中的路由代码是:

resources.router.routes.resolution.route = '/resolution/:res/'
resources.router.routes.resolution.type = "Zend_Controller_Router_Route" 
resources.router.routes.resolution.defaults.module = default
resources.router.routes.resolution.defaults.controller = resolution
resources.router.routes.resolution.defaults.action = index
resources.router.routes.resolution.defaults.res=

问题是它在我的本地计算机上工作但不在我的主机中。 此网址mysite.com/resolution/index/res/1024x768有效但/resolution/1024x768不起作用。在生产环境中我还需要做些什么吗?

我在访问/resolution/1024x768时获得了以下请求参数:

Request Parameters:
array (
  'controller' => 'resolution',
  'action' => '1024x768',
  'module' => 'default',
) 

更新:听起来很奇怪,上面路由代码中的第一行需要放在双引号内,如下所示:

resources.router.routes.resolution.route = "/resolution/:res/"

1 个答案:

答案 0 :(得分:0)

您可以尝试:

resources.router.routes.resolution.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.resolution.route = '/resolution/(.*)'
resources.router.routes.resolution.defaults.module = default
resources.router.routes.resolution.defaults.controller = resolution
resources.router.routes.resolution.defaults.action = index
resources.router.routes.resolution.map.1 = "res"

<强> [更新]