我有这样的代码,但这并不费力
$route = new Zend_Controller_Router_Route_Static ('viewmodel', array (
'controller' => 'Index',
'action' => 'viewmodel'
));
$router->addRoute('viewmodel', $route);
P.S:工作代码
$routerTwo = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(':index/:viewmodel/:id', array (
'controller' => 'index',
'action' => 'viewmodel'
));
$routerTwo->addRoute('viewmodel', $route);
答案 0 :(得分:0)
试试
$route = new Zend_Controller_Router_Route('index/viewmodel/id/:id', array (
'controller' => 'index',
'action' => 'viewmodel'
));
$router->addRoute('viewmodel', $route);
在您可以访问的操作中:id $this->getRequest()->getParam('id');