当我想看到我的“联系”页面时出现此错误:
致命错误:第27行的/opt/lampp/htdocs/Symfony/src/MPU/WelcomeBundle/Controller/PageController.php中找不到类'Symfony \ scr \ MPU \ WelcomeBundle \ Entity \ Inquiry'
我的控制器无法读取类查询,也无法读取EnquiryType,即使我提供了确切的路径!
这是我的控制器:
// SRC / MPU / WelcomeBundle /控制器/ PageController.php
<?php
namespace MPU\WelcomeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\scr\MPU\WelcomeBundle\Entity\Enquiry;
use Symfony\scr\MPU\WelcomeBundle\Form\EnquiryType;
class PageController extends Controller{
public function contactAction(){
$enquiry = new Enquiry();
$enquiry_type = new EnquiryType();
$form = $this->createForm($enquiry_type, $enquiry);
$request = $this->getRequest();
if ($request->getMethod() == 'POST') {
$form->bindRequest($request);
if ($form->isValid()) {
return $this->redirect($this->generateUrl('MPUWelcomeBundle_contact'));
}
}
return $this->render('MPUWelcomeBundle:Page:contact.html.twig', array('form' => $form->createView()));
}
}
?>
以下是班级咨询:
// SCR / MPU / WelcomeBundle /实体/查询
<?php
namespace MPU\WelcomeBundle\Entity;
class Enquiry
{
protected $name;
protected $email;
protected $subject;
protected $body;
public function getName(){
return $this->name;
}
public function setName($name){
$this->name = $name;
}
public function getEmail(){
return $this->email;
}
public function setEmail($email){
$this->email = $email;
}
public function getSubject(){
return $this->subject;
}
public function setSubject($subject){
$this->subject = $subject;
}
public function getBody(){
return $this->body;
}
public function setBody($body){
$this->body = $body;
}
}
?>
最后是EnquiryType:
// SCR / MPU / WelcomeBundle /窗体/ EnquiryType
<?php
namespace MPU\WelcomeBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class EnquiryType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options){
$builder->add('name');
$builder->add('email', 'email');
$builder->add('subject');
$builder->add('body', 'textarea');
}
public function getName(){
return 'contact';
}
}
?>
为什么我收到消息:找不到课程?谢谢!