开发者

a zend framework routing question

开发者 https://www.devze.com 2023-03-10 07:34 出处:网络
i want to route my url /resolution/index/res/1024x768 to /resolution/1024x768 the routing code in application.ini is:

i want to route my url /resolution/index/res/1024x768 to /resolution/1024x768 the routing code in application.ini is:

resources.router.routes.resolution.route = '/resolution/:res/'
resources.router.routes.resolution.type = "Zend_Controller_Router_Route" 
resources.router.routes.re开发者_开发问答solution.defaults.module = default
resources.router.routes.resolution.defaults.controller = resolution
resources.router.routes.resolution.defaults.action = index
resources.router.routes.resolution.defaults.res=

the problem is that its working in my local computer but not in my host. this url mysite.com/resolution/index/res/1024x768 works but /resolution/1024x768 doesnt. is there something more i need to do in production environment ?

i get the follow request parameters when accessing /resolution/1024x768:

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

Update: as weird as it may sound, the first line in above routing code needed to be placed inside double quotes, like this:

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


You can try:

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"

[Updated]

0

精彩评论

暂无评论...
验证码 换一张
取 消