当我添加此路线时
$classes_router = new Zend_Controller_Router_Route(
'/:filter1/:filter2/*',
array(
'module' => 'course',
'controller' => $filter_controller,
'action' => 'index',
'filter1' => '',
'filter2' => ''
)
);
默认路由:module/:controller/:action
不再起作用。请告诉我这是什么问题?
答案 0 :(得分:2)
问题是对somemodule/somecontroller/someaction
的请求将与您添加的路由匹配(将在默认路由之前进行检查)。您需要在路径中提供一些限制以确定它匹配的内容,可能通过限制:filter1
变量的可能匹配项:
$classes_router = new Zend_Controller_Router_Route(
'/:filter1/:filter2/*',
array(
'module' => 'course',
'controller' => $filter_controller,
'action' => 'index',
'filter1' => '',
'filter2' => ''
), array(
'filter1' => '(value1|foo|somethingelse)'
)
);
或添加静态前缀:
$classes_router = new Zend_Controller_Router_Route(
'/filter/:filter1/:filter2/*',
array(
'module' => 'course',
'controller' => $filter_controller,
'action' => 'index',
'filter1' => '',
'filter2' => ''
)
);