0
我想設置多個路由指向同一控制器的zend這樣:多路線與標準路由器(Zend框架)
URL | Controller::Action
=================================================================================
http://mysite/tasks/:level/ | Objectives::Objectives
http://mysite/tasks/:level/:objective/ | Objectives::tasks
http://mysite/tasks/:level/:objective/:taskID/ | Objectives::view
我已經試過如下:
<?php
$router->addRoute('objectives', new Zend_Controller_Router_Route(
'task/:level/:objective/:taskID/',
array(
'controller' => 'objectives',
'action' => 'view'
)
));
$router->addRoute('objectives', new Zend_Controller_Router_Route(
'task/:level/:objective/',
array(
'controller' => 'objectives',
'action' => 'tasks'
)
));
$router->addRoute('objectives', new Zend_Controller_Router_Route(
'task/:level/',
array(
'controller' => 'objectives',
'action' => 'tasks'
)
));
?>
然而,最後一條規則似乎覆蓋了路由器中的以前的規則..我一遍又一遍地閱讀了路由器的Zend文檔,我有一種感覺,就是錯過了一些東西 - 我應該使用不同的路由器類嗎?
任何幫助深表感謝