0

我的目标是为这种情况创建通用路线:

http://test.com/pages/cat_name/about
http://test.com/pages/?????/about
http://test.com/pages/about

....我在引导程序中写道:

$router->addRoute("pages",new Zend_Controller_Router_Route_Regex(
            'pages/(\w+)/:stitle',
             array( 'controller'    =>  'pages',
                'action'    =>  'index',
                'module'    =>  'pages')));

但它仍然不起作用。怎么了?

4

1 回答 1

0

你的代码应该是这样的:

$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(':interface/:module/:controller/:action/*',
        array('interface' => 'en',
              'module' => 'pages',
              'controller' => 'pages',
              'action' => 'index'));
$router->addRoute('route_name', $route);
于 2013-08-23T04:06:58.593 回答