Hi all I'm having an issue with my routing in Zend Framework 1
. I keep getting this error:
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',
)
This is my link in the 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>
I have a Controller
called JournalController in the default subdirectory of modules. It has a method called testfree( ). I would like to call this method.
This is the code for the Controller
public function testfree(){
echo "test free";
die();
}
I have no experience working with Zend
. I am trying to make a change to a piece of work a colleague of mine did. Can anyone advise me on where I am going wrong? Do I need to update something in the Bootstrap.php
file?
Any help is much appreciated
testfree
is an action so try to add 'Action' to the name:
public function testfreeAction(){
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.