Zend framework我有一个带rest路由的Restful控制器。http://framework.zend.com/manual/1.12/en/zend.controller.router.html zend.controller.router.routes.rest
$front = Zend_Controller_Front::getInstance();
$restRoute = new Zend_Rest_Route($front, array(), array(
'product' => array('ratings')
));
$front->getRouter()->addRoute('rest', $restRoute);
在ratings
控制器中,我有一个indexAction
响应url product/ratings/
的http get
请求
现在在ratings
控制器我添加了一个新的动作:browseAction
。我想当数字url product/ratings/browse
响应indexAction
。
解决方案
$route = new Zend_Controller_Router_Route_Static ( 'product/ratings/browse', array (
'controller' => 'ratings',
'module' => 'product',
'action' => 'index'
) );
$front->getRouter ()->addRoute ( 'browse', $route );