2011-06-02 127 views
0

我想航線我的網址/resolution/index/res/1024x768/resolution/1024x768application.ini路由代碼:Zend框架的路由問題

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/" 
+0

哪些是在本地主機相同的URL請求參數? – emaillenin 2011-06-02 05:44:08

+1

嘗試改變你的路線'分辨率/:res'(沒有斜線) – emaillenin 2011-06-02 05:52:23

+0

@emaillenin試過,沒有工作 – anp 2011-06-02 08:43:41

回答

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" 

[更新]

+0

試過這個,產生一個'Zend_Config_Exception'異常,必須是這個代碼出錯 – anp 2011-06-02 08:45:28

+0

哦,類型需要是「Zend_Controller_Router_Route_Regex」 – zzarbi 2011-06-02 15:56:30