2013-01-12 52 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') 

它告訴你,你還需要傳遞'別名'。