大家好,我在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>
我在模块的默认子目录中有一个名为JournalController的Controller
。它有一个名为testfree()的方法。我想调用此方法。
这是Controller
的代码
public function testfree(){
echo "test free";
die();
}
我没有使用Zend
的经验。我正试图对我的一位同事所做的一项工作进行修改。有人能告诉我哪里出了问题吗?我需要更新Bootstrap.php
文件中的某些内容吗?
任何帮助都非常感谢
testfree
是一个操作,请尝试将"操作"添加到名称中:
public function testfreeAction(){
...
}