2010-02-12 5 views
4

젠드 프레임 워크를위한 INI 파일로 경로를 아래와 같이 정의하려고합니다 : http://api.example.com/servicename/ {버전}/users/: 사용자 ID/항목/: itemidZend 프레임 워크의 ini 파일에 경로 체인 체인을 작성하려면 어떻게해야합니까?

routes.host.type = "Zend_Controller_Router_Route_Hostname" 
routes.host.route = "api.example.com" 

routes.host.chains.api.type = "Zend_Controller_Router_Route_Static" 
routes.host.chains.api.route = "servicename/v1" 
routes.host.chains.api.defaults.controller = "servicename-v1-api" 
routes.host.chains.api.defaults.action = "index" 

routes.host.chains.api.chains.users.chains.user.type = "Zend_Controller_Router_Static" 
routes.host.chains.api.chains.users.route = "users" 
routes.host.chains.api.chains.users.defaults.controller = "users" 
routes.host.chains.api.chains.users.defaults.action = "index" 

routes.host.chains.api.chains.users.chains.user.type = "Zend_Controller_Router_Route" 
routes.host.chains.api.chains.users.chains.user.route = ":id" 
routes.host.chains.api.chains.users.chains.user.defaults.controller = "user" 
routes.host.chains.api.chains.users.chains.user.defaults.action = "index" 
... 

host-api 라우트는 잘 작동하지만 내가 다른 경로에 도달하려고하면 오류가 발생합니다 '요청에 일치하는 경로 없음'

chains.something.chains.somethingelse 어색해 보이므로 올바른 방법이 아닙니다. 누군가?

답변

3

나는 그것을하는 방법을 발견했다고 생각합니다. 기본적으로, 각 경로의 부분을 abstract로 설정하고 각 경로를 유형이 Zend_Controller_Router_Route_Chain으로 설정된 경로로 연결합니다. 다음과 같음 :

[...] 
routes.users.type = "Zend_Controller_Router_Route" 
routes.users.route = "users" 
routes.users.abstract = "1" 
routes.users.defaults.controller = "users" 
routes.users.defaults.action = "index" 

routes.host-api-users.type = "Zend_Controller_Router_Route_Chain" 
routes.host-api-users.chains = "host, api, users" 
+0

안녕하세요, 체인 정의 오류가 발생했습니다. –

관련 문제