致命错误:class' LoginForm'在Zend框架2中找不到

时间:2015-12-04 03:55:09

标签: php zend-framework

我陷入了zend框架,当我尝试登录时,我收到此错误消息:致命错误:Class' Anuncios \ Form \ LoginForm'在第28行的C:\ Program Files(x86)\ Zend \ ZendServer \ data \ apps \ http__default __ \ 0 \ AplicacaoMediador1 \ 1.0.0_86 \ module \ Anuncios \ src \ Anuncios \ Controller \ AnunciosController.php中找不到 在这一行,我确实实例化了一个LoginForm类的对象,该对象位于"表格"文件夹。

这是控制器代码:

use Zend\Http\Request;
use Zend\Mvc\Controller\AbstractActionController;

use Anuncios\DTO\Credenciais;
use Anuncios\Infrastucture\Services\ImoServices;
use Anuncios\Form\LoginForm;

class AnunciosController extends AbstractActionController
{
public function indexAction()
{
    return array();
}

public function loginAction()
{
    $form = new LoginForm();
    $form->get('submit')->setValue('Login');

    $request = $this->getRequest();
    if ($request->isPost()) {

        session_start();
        ImoServices::Logout();

        $credenciais = new Credenciais();
        $form->setInputFilter($credenciais->getInputFilter());
        $form->setData($request->getPost());

        if ($form->isValid()) {
            $credenciais->exchangeArray($form->getData());

            if( ImoServices::Login($credenciais) )

                // Redirect to values
                return $this->redirect()->toRoute('anuncios', array('controller'=>'anuncios', 'action' => 'values'));
        }
    }
    return array('form' => $form);
}

这是LoginForm类:

namespace Anuncios\Form;

use Zend\Form\Form;

class LoginForm extends Form
{
public function __construct($name = null)
{
    // we want to ignore the name passed
    parent::__construct('credenciais');

    $this->add(array(
        'name' => 'username',
        'type' => 'Text',
        'options' => array(
            'label' => 'Username',
        ),
    ));
    $this->add(array(
        'name' => 'password',
        'type' => 'Password',
        'options' => array(
            'label' => 'Password',
        ),
    ));

    $this->add(array(
        'name' => 'submit',
        'type' => 'Submit',
        'attributes' => array(
            'value' => 'Go',
            'id' => 'submitbutton',
        ),
    ));
}
}

0 个答案:

没有答案