我已经尝试了许多不同的方法来解决我在网上找到的这个问题,但它们没有奏效,所以请有人帮助我。
我收到此错误
致命错误:在第 13 行的 pathToProject/modules/admin/controllers/LoginController.php 中找不到类“Admin_Form_Login”
我的项目是
应用
--- 模块
- - - 行政
--------控制器
- - - - 形式
- - - - 楷模
--------观看次数
- - - 默认
--------控制器
- - - - 形式
- - - - 楷模
--------观看次数
- - - 关于我们
--------控制器
- - - - 形式
- - - - 楷模
--------观点等
我的控制器
class Admin_LoginController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$form = new Admin_Form_Login();
$this->view->form = $form;
// action body
}
}
我的表格
class Admin_Form_Login extends Zend_Form
{
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setAction("/admin/index/login")->setMethod("post");
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Username')
->setOptions(array('size' => '30'));
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')
->setOptions(array('size' => '30'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Log in')
->setOptions(array('class' => 'submit'));
$this->addElement($username)
->addElement($password)
->addElement($submit);
}
}
我的 Bootstrap.php
class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initAutoload() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Admin_',
'basePath' => APPLICATION_PATH."/modules/admin",
));
return $autoloader;
}
}
这是我的 App ini 可能里面有东西
[bootstrap]
Autoloadernamespaces[] = "Admin_"
Autoloadernamespaces[] = "Default_"
Autoloadernamespaces[] = "Aboutus_"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "default"
resources.modules[] = ""
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = "1"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
admin.resources.layout.layout = layout
admin.resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
default.resources.layout.layout = default
default.resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
[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
和我的看法
$this->form
谢谢你的帮助。
我在生产部分中添加了以下内容,我的 application.ini 并开始工作不知道为什么。
Autoloadernamespaces[] = "Admin_"
Autoloadernamespaces[] = "Default_"
Autoloadernamespaces[] = "Aboutme_"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "default"
resources.modules[] = ""
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"