2013-03-13 124 views
-1

我收到以下错误页找不到错误在Zend框架

An error occurred 
Page not found 
Exception information: 

Message: Action "index" does not exist and was not trapped in __call()`` 

Stack trace: 0 /var/www/square/library/Zend/Controller/Action.php(518): Zend_Controller_Action->__call('indexAction', Array) 
1 /var/www/square/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('indexAction') 
2 /var/www/square/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Htt‌​p), Object(Zend_Controller_Response_Http)) 
3 /var/www/square/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() 
4 /var/www/square/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() 
5 /var/www/square/public/index.php(26): Zend_Application->run() 
6 {main} Request Parameters: array ('module' => 'catalog', 'controller' => 'item', 'action' => 'index',) 

我试图使用的网址:

/square/public/catalog/item/ 
+0

什么是你的控制器应运行?目录 ? – MatRt 2013-03-13 06:24:16

+0

不,它的ItemController – ZendIsMyLife 2013-03-13 06:30:18

+0

所以,在你的itemController中,你有没有公共函数indexAction? – MatRt 2013-03-13 06:32:52

回答

1

在你的代码,你指定的控制器ItemController和当你试图运行该程序时,执行的动作是indexAction.First检查你是否在你的控制器中写入了indexAction。如果它不在你的控制器中指定索引动作..我猜这是问题..并尝试发布你的代码也是。

+0

是的,我增加了indexAction和index.phtml,但我仍然收到错误:: Message:script' item/index.phtml'找不到路径(/var/www/square/application/modules/catalog/views/scripts/).你想看看ItemController的代码 – ZendIsMyLife 2013-03-13 07:04:58

+0

@ user1073122请告诉我应该写什么代码在indexAction中运行以下代码: – ZendIsMyLife 2013-03-13 07:10:24

+0

<?php class Catalog_ItemController extends Zend_Controller_Action { public function init() {this-> view-> doctype('XHTML1_STRICT'); } 公共功能的indexAction() { } } } 功能displayAction()为GET输入 $滤波器 { //设置过滤器和验证=阵列( 'ID'=>数组(' StripTags','StringTrim') ); $ validators = array( 'id'=> array('NotEmpty','Int') ); //测试输入是否有效 //检索请求的记录 //附加查看 $ input = new Zend_Filter_Input($ filters,$ validators); $ input-> setData($ this-> getRequest() - > getParams()); if($ input-> isValid()){ $ this-> db = new PDO('mysql: – ZendIsMyLife 2013-03-13 07:12:41

0

除了已经说过的东西,我看到你正在使用模块。您是否在ZF配置中启用了此功能(或直接在源代码中的某处,例如Boostrap)?

在的application.ini,你应该有这样的事情:

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 

而且模块(我认为)必须包含它自己的自举类(扩展Zend_Application_Module_Bootstrap)

+0

yes application.ini包含上述建议的行 – ZendIsMyLife 2013-03-13 07:17:45