我在一个名为signin-zend framework version 1的模块中创建了一个名称为signin的表单,上面写着"找不到类'sign_form_signin'"
这是表单代码:
<?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);
}
}
这是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
这是控制器代码:
<?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
}
}
你知道问题出在哪里吗?
如果您的姓名表单是新的Sign_form_Signin()
您必须在Sign/form/Signin.php中找到类表单
类名的每个_ in都表示实际路径的一个目录。