2013-01-12 51 views
0

我在这里遇到了一些问题。我目前正试图使用​​Zend路由器重写,但我得到这个错误:Zend Framework - 未指定参数

Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with message 'alias is not specified' 

这里是我的路线代码:

// BLOG -> CATEGORIES -> LIST ARTICLES 
$route = new Zend_Controller_Router_Route(
    '/blog/categories/:alias', 
    array(
     'module'  => 'blog', 
     'controller' => 'categories', 
     'action'  => 'list' 
    ) 
); 
$router->addRoute('blog-categories-list', $route); 

我想要访问的网址是:/blog/categories/general/

为什么我会收到此错误?

PS:我没有为:alias指定一个默认值,因为我有这条路线也:

// BLOG -> CATEGORIES 
$route = new Zend_Controller_Router_Route(
    'blog/categories/', 
    array(
     'module'  => 'blog', 
     'controller' => 'categories', 
     'action'  => 'index' 
    ) 
); 
$router->addRoute('blog-categories', $route); 

回答

1

这个错误可能是从什么地方来,你正在使用的路线试图输出链接,如URL助手:

$this->url(array(), 'blog-categories-list') 

它告诉你,你还需要传递'别名'。