2011-04-04 88 views
1

如何優化所有這些路由爲一個。正如我們在.htaccess文件中所做的那樣。zend路由器優化

routes.addemails.type = "Zend_Controller_Router_Route_Regex" 
routes.addemails.route = "campaign/email/add" 
routes.addemails.defaults.module = campaignManagement 
routes.addemails.defaults.controller = Email 
routes.addemails.defaults.action = add 


routes.updateEmail.type = "Zend_Controller_Router_Route_Regex" 
routes.updateEmail.route = "campaign/email/edit/?([a-zA-Z0-9_-]+)?" 
routes.updateEmail.defaults.module = campaignManagement 
routes.updateEmail.defaults.controller = Email 
routes.updateEmail.defaults.action = edit 
routes.updateEmail.map.key = 1 

routes.delEmail.type = "Zend_Controller_Router_Route_Regex" 
routes.delEmail.route = "campaign/email/delete/?([a-zA-Z0-9_-]+)?" 
routes.delEmail.defaults.module = campaignManagement 
routes.delEmail.defaults.controller = Email 
routes.delEmail.defaults.action = delete 
routes.delEmail.map.id = 1 

回答

2

我沒有設置使用配置文件的路徑,而且一目瞭然嘗試:

​​

我假設地圖*在URL中的變量(這樣的行動。是正則表達式的第一位,id是正則表達式的第二位,如果我錯了,糾正我)。

+0

你是對的:)。我正在嘗試routes.emails.defaults.action = 1 :) – Developer 2011-04-04 12:00:54