zend_form配置问题

Sub*_*ger 1 zend-framework zend-config

我有一个如下结构:

/application
.....
--/modules
----/structure
------/controllers
--------/indexController.php
------/forms
--------/Department.php //here class Structure_Form_Department extends Zend_Form
Run Code Online (Sandbox Code Playgroud)

在indexController.php中

...
public function saveAction()
    {
        $request = $this->getRequest();
        $form = new Structure_Form_Department();//<-- error
....
}
Run Code Online (Sandbox Code Playgroud)

我得到错误

致命错误:未找到类"Structure_Form_Department"

当尝试zf enable form module- 接收:

An Error Has Occurred                         
 This project already has forms enabled.
Run Code Online (Sandbox Code Playgroud)

我认为这是一个配置问题...但不明白我需要做什么...

编辑1

这里找到了很好的解

但是从某种程度上说,zend开始重复执行_init...默认bootstrap.php中的函数....

Pus*_*dra 12

几个月前我也遇到了类似的问题,我通过编写以下代码得到了解决方案:

在application.ini中

autoloadernamespaces[] = "Structure_"
Run Code Online (Sandbox Code Playgroud)

在Bootstrap.php中

protected function _initAutoload()
    {
        $autoloader=new Zend_Application_Module_Autoloader(array(
                'namespace' => 'Structure',
                'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'Structure'
            ));
    }
Run Code Online (Sandbox Code Playgroud)

并在index.php

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH),
    get_include_path(),
)));
Run Code Online (Sandbox Code Playgroud)

如果它不起作用,请告诉我.....