[Zend_Form][1.11.1] 错误消息 致命错误:在 ...\modules\default\controllers\IndexController.php 中找不到



我英语说得不流利(我是法国人),所以我会的我按照教程操作得到了这个结构

Application
--Modules
------admin
---------controller
---------views
------etat
---------controller
---------views
------default
---------controller
---------views
--configs
bootstrap.php

我的问题是,当我创建了我的第一个表单并试图在浏览器中查看它时,我得到了以下错误:

致命错误:在C:wampwwwgetapplicationmodulesdefaultcontrollersIndexController.php第14行中没有找到Admin_Form_Login类.

下面是我的代码:

  • 我的控制器:/modules/etat/controller/IndexController.php
    class Etat_IndexController extends Zend_Controller_Action
    {
        public function init()
        {
            /* Initialize action controller here */
        }
        public function indexAction()
        {
            // action body
            $form = new Etat_Form_InfoAgent();
            $this->view->form = $form;
        }
    }
    

  • 我的表格:/modules/etat/forms/InfoAgent.php
    class Etat_Form_InfoAgent extends Zend_Form
    {
        public function init()
        {
            /* Form Elements & Other Definitions Here ... */
            $this->setName('infoagent');
            $this->setMethod('post');
            $login = new Zend_Form_Element_Text('matricule');
            $login->setLabel('Matricule:');
            $login->setRequired(true);
            $login->addFilter('StripTags');
            $login->addFilter('StringTrim');
            $this->addElement($login);
            $password = new Zend_Form_Element_Password('agence');
            $password->setLabel('Code agence:');
            $password->setRequired(true);
            $password->addFilter('StripTags');
            $password->addFilter('StringTrim');
            $this->addElement($password);
            $submit = new Zend_Form_Element_Submit('submit');
            $submit->setLabel('Valider');
            //$submit->style = array('float: right');
            $this->addElement($submit);       
        }
    
    }
    

  • My view: /modules/etat/view/script/index.phtml
    <br /><br />
    <div id="view-content">
        <?php echo $this->form; ?>
    </div>
    

  • 配置文件configs/application.ini
    [production]
    phpSettings.display_startup_errors = 0
    phpSettings.display_errors = 0
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    appnamespace = "Application"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    resources.frontController.params.displayExceptions = 0
    ;Modular structure
    resources.modules[] =
    resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
    resources.frontController.params.prefixDefaultModule = "1"
    ;database ressources
    resources.db.adapter = PDO_MYSQL
    resources.db.params.host = localhost
    resources.db.params.username = root
    resources.db.params.password = 
    resources.db.params.dbname = bd_test
    [staging : production]
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    resources.frontController.params.displayExceptions = 1
    

    我有在网上搜索解决方案但我没有得到它。我在你的网站(stackoverflow)上看到了一个关于同样问题的帖子,我试图在没有解决我的问题的情况下应用你的说明。我没有改变我的引导和我的public/index.php文件的代码

    我希望你能尽快帮助我。thx
  • 确保在每个模块目录中创建了一个Bootstrap.php,如下所示:

    class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
    {}
    

    其中Admin为模块名。另外,确保在目录modules/admin/forms中确实有一个文件Login.php,并带有一个类Admin_Form_Login

    相关内容