2014-10-01 78 views
0

大家好我有我的路由問題在Zend Framework 1。我不斷收到此錯誤:Zend Framework 1路由問題異常

Exception information: 

Message: Action "testfree" does not exist and was not trapped in __call() 
Stack trace: 

#0 Zend/Controller/Action.php(518): Zend_Controller_Action->__call('testfreeAction', Array) 
#1 Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('testfreeAction') 
#2 Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) 
#3 Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() 
#4 Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() 
#5 public/index.php(46): Zend_Application->run() 
#6 {main} 

Request Parameters: 

array (
    'controller' => 'journal', 
    'action' => 'testfree', 
    'journal_id' => '23', 
    'module' => 'default', 
) 

這是我在html

<a class="button" 
    href="<?php echo $this->url(
     array(
      'module'  => 'default', 
      'controller' => 'journal', 
      'action'  => 'testfree', 
      'journal_id' => $this->journal->id 
     ), 
     null, 
     false) 
?>">Test Free</a> 

鏈接我有一個Controller模塊的默認安裝目錄中稱爲JournalController。它有一個名爲testfree()的方法。我想調用這個方法。

這是Controller

public function testfree(){ 
     echo "test free"; 
     die(); 
    } 

我沒有經驗與Zend使用的代碼。我正在嘗試改變我的一位同事的工作。任何人都可以告訴我我要去哪裏?我需要更新Bootstrap.php文件中的內容嗎?

任何幫助深表感謝

+0

嘿!請考慮在生產環境中將錯誤顯示關閉! [http://isel.lightboxdigital.ie/journal/testfree](http://isel.lightboxdigital.ie/journal/testfree) – 2014-10-01 15:11:34

+0

最簡單的方法是使用zftool來避免這種類型的問題。 – 2014-10-01 18:43:48

回答

3

testfree是一個動作,使盡量'操作'添加到名稱:

public function testfreeAction(){ 
    ... 
}