简体   繁体   中英

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 "

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

[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();

You must to locate the class form in Sign/Form/Signin.php

Each _ in of the classname means a directory for the real path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM