2 개의 맞춤 경로를 정의했습니다. 하나는 threads/:id/:name
이고 다른 하나는 threads/tags/:tagName
인데 두 번째는 첫 번째와 충돌합니다. 둘 다 첫 번째 나누기를 수행하고 \d+
요구 사항을 준수하지 않는 동작으로 말하면 :id
을 그대로 처리하기 때문에 (순수 정규식 경로를 사용해 보았습니다, 아래 참조) .젠드 경로 충돌
액션 "1"존재하지 내가 노선의 재 배열 순서 시도
__call()에 갇혀 아니었지만 내가 할 경우 다음 threads/tags/:tagName
나던 올바르게를 캡처 할 수 않습니다 tagName.
기본 경로를 사용하지 않도록 설정했지만 경로가 여전히 제대로 작동하지 않습니다.
protected function _initRoutes() {
$fc = Zend_Controller_Front::getInstance();
$router = $fc->getRouter();
$router->addRoute(
'threads',
new Zend_Controller_Router_Route('threads/:id/:name',
array(
'controller' => 'threads',
'action' => 'thread',
),
array(
'id' => '\d+'
)
)
);
$router->addRoute(
'threads',
new Zend_Controller_Router_Route('threads/tags/:tagName',
array(
'controller' => 'threads',
'action' => 'tags',
),
array(
'tagName' => '[a-zA-Z]+'
)
)
);
}
가 나는 또한 순수한 정규식 경로를 사용하여 시도했지만 실패했다, 내가 잘못했기 때문에 가장 가능성 : 해결
$router->addRoute(
'threads',
new Zend_Controller_Router_Route_Regex(
'threads/(\d+)/([a-zA-Z]+)',
array(
'controller' => 'threads',
'action' => 'thread',
),
array(
1 => 'tagName',
2 => 'name'
)
)
);