[英]php - “Fatal error: Class not found” zend framework 1
I have created a form named signin in a module named sign in zend framework version 1 and it says "Class 'Sign_Form_Signin' not found " 我在一个名为sign in zend framework version 1的模块中创建了一个名为signin的表单,它说“找不到类”Sign_Form_Signin'
Here is form code: 这是表单代码:
<?php
class Sign_Form_Signin extends Zend_Form
{
public function init()
{
$this->setAction("/sign/in");
$this->setMethod("post");
$username=new Zend_Form_Element_Text("password");
$username->addValidator(new Zend_Validate_Alnum())
->setRequired(TRUE)
->setLabel("نام کاربری: ")
->setAttrib("size", "25");
$password=new Zend_Form_Element_Password("password");
$password->addValidator(new Zend_Validate_Alnum)
->setRequired(TRUE);
$submit=new Zend_Form_Element_Submit("submit");
$submit->setLabel("ورود");
$this->addElement($username);
$this->addElement($password);
}
}
Here is Application.ini 这是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
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "test"
resources.db.params.host = "localhost"
resources.db.params.port="8889"
resources.db.params.username = "root"
resources.db.params.password = "root"
resources.db.params.charset = "UTF8"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
[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
and here is the controller code: 这是控制器代码:
<?php
class Sign_IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
public function inAction()
{
$form=new Sign_Form_Signin();
$this->view->form= $form;
}
public function outAction()
{
// action body
}
}
Do you have any ideas that what the problem is? 你有什么想法,问题是什么?
If your name form is new Sign_Form_Signin(); 如果你的名字形式是新的Sign_Form_Signin();
You must to locate the class form in Sign/Form/Signin.php 您必须在Sign / Form / Signin.php中找到类表单
Each _ in of the classname means a directory for the real path. classname中的每个_ in表示真实路径的目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.