当网址为http://site.com/api/location/ {location_id} / comment /
时,如何在CommentController中使用Index Action我有代码
$r = new Zend_Controller_Router_Route_Regex('api/location/(.*)/comment',
array('module' => 'api' ,'controller' => 'comment', 'action' => 'index'),
array(1 => 'param1')
);
$router->addRoutes('route6', $r);
但它不起作用,它不执行IndexAction但返回OK。我该如何解决?
p / s:location也是一个cotroller
答案 0 :(得分:0)
尝试
$r = new Zend_Controller_Router_Route_Regex('api/location/([\d]+)/comment',
array('module' => 'api' ,'controller' => 'comment', 'action' => 'index'),
array(1 => 'param1')
);
$router->addRoute('route6', $r);
并非我更改了正则表达式并将addRoutes更改为addRoute