Zend框架向restful控制器添加路由


Zend Framework adding route to restful controller

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 );