2014-10-01 139 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(){ 
    ... 
}