我遇到了 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)。但是当我点击时,它会返回一个 url - http://localhost/
问题可能出在哪里?