zend_Controller_Router_Route 的问题
我在 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/
问题可能出在哪里?
I have a trouble with zend_controller_Router_Route.
I have created a 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);
and this my view script:
<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>
when i move mouse over a category, its href is exact (example :http://localhost/projectzend/chapter5/public/catalog/hats). But when i click, it return a url - http://localhost/
Where could be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论