Php 致命错误:类';LoginForm';在Zend framework 2中找不到
我被困在zend framework中,当我尝试登录时,我收到以下错误消息:致命错误:在第28行的C:\Program Files(x86)\zend\ZendServer\data\apps\http\Uuuu default\Uuu0\AplicacaoMediador1\1.0.0\u86\module\Anuncios\src\Anuncios\Controller\AnunciosController.php中找不到类'AnunciosController' 在这一行,我实例化了LoginForm类的一个对象,它位于“Form”文件夹中 以下是控制器代码:Php 致命错误:类';LoginForm';在Zend framework 2中找不到,php,zend-framework,Php,Zend Framework,我被困在zend framework中,当我尝试登录时,我收到以下错误消息:致命错误:在第28行的C:\Program Files(x86)\zend\ZendServer\data\apps\http\Uuuu default\Uuu0\AplicacaoMediador1\1.0.0\u86\module\Anuncios\src\Anuncios\Controller\AnunciosController.php中找不到类'AnunciosController' 在这一行,我实例化了Log
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',
),
));
}
}
AnunciosController
类的完整名称空间是什么?Anuncios\Form\LoginForm
类的完整路径和文件名是什么?名称空间是Anuncios\Controller
。“完整名称空间”是指所有内容吗?然后是module\Anuncios\src\Anuncios\Controller\AnunciosController
,Anuncios\Form\LoginForm
类的完整路径是module\Anuncios\src\Anuncios\Form\LoginForm
。文件名是LoginForm
。所有这些看起来都不错。为了帮助缩小问题范围,请查看Credenciais
类是否可以通过复制$Credenciais=new Credenciais()由AnunciosController
类访问代码>直接在$form=new LoginForm()上方的行代码>。然后尝试登录。如果您收到相同的错误消息,那么您就知道问题出在LoginForm
类上。如果您收到另一条错误消息,提示无法加载Credenciais
类,则此处存在更广泛的自动加载问题。您能否提供Anuncios模块的module.config.php代码?AnunciosController
类的完整命名空间是什么?Anuncios\Form\LoginForm
类的完整路径和文件名是什么?名称空间是Anuncios\Controller
。“完整名称空间”是指所有内容吗?然后是module\Anuncios\src\Anuncios\Controller\AnunciosController
,Anuncios\Form\LoginForm
类的完整路径是module\Anuncios\src\Anuncios\Form\LoginForm
。文件名是LoginForm
。所有这些看起来都不错。为了帮助缩小问题范围,请查看Credenciais
类是否可以通过复制$Credenciais=new Credenciais()由AnunciosController
类访问代码>直接在$form=new LoginForm()上方的行代码>。然后尝试登录。如果您收到相同的错误消息,那么您就知道问题出在LoginForm
类上。如果您收到另一条错误消息,提示无法加载Credenciais
类,则此处存在更广泛的自动加载问题。您能否提供Anuncios模块的module.config.php代码??