我在使用zend_controller_Router_Route时遇到了问题。
我创建了一条路线:
$router = $this->frontController->getRouter();
$route = new Zend_Controller_Router_Route(
'catalog/:categoryIdent/:page',
array( 'action' => 'index',
'controller' => 'catalog',
'module' => 'storefront',
'categoryIdent' => '',
'page' => 1 ),
array( 'categoryIdent' => '[a-zA-Z-_0-9]+',
'page' => '\d+' ) ); $router->addRoute('catalog_category', $route);
这是我的视图脚本:
<div class="sub-nav">
<h3>select <span>category</span></h3>
<ul>
<? foreach ($this->categories as $category): ?>
<li><a href="<?=$this->url(array('categoryIdent' => $category->ident), 'catalog_category', true );?>"><?=$category->name; ?></a></li>
<? endforeach; ?>
</ul>
当我将鼠标移到某个类别上时,其href是准确的(例如:http:// localhost / projectzend / chapter5 / public / catalog / hats)。但是当我点击它时,它会返回一个网址 - http://localhost/
哪里可能是问题?