1

我是 symfony 的新手,也许我错过了一些非常简单的东西,但我无法发现它。任何帮助都感激不尽。我有这两个文件:

C:\xampp\htdocs\Symfony\src\Apps01\ResourceCalBundle\Resources\config\routing.yml

ResourceCalendar_Login:
    pattern:   /resourcecalendar/login
    defaults:  { _controller: AppsRollerResourceCalBundle:Login:DisplayLogin }

C:\xampp\htdocs\Symfony\src\Apps01\ResourceCalBundle\Controller\LoginController.php

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class LoginController
{
public function DisplayLoginAction()
{
    return new Response('<html><body>Hello There!</body></html>');
}
}

然而,当我将浏览器指向http://example.com/Symfony/web/app_dev.php/resourcecalendar/login时,出现以下错误:

 The autoloader expected class "Apps01\ResourceCalBundle\Controller\LoginController" to be defined in file "C:\xampp\htdocs\Symfony/src/\Apps01\ResourceCalBundle\Controller\LoginController.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
 500 Internal Server Error - RuntimeException 

LoginController当我看到类肯定存在于文件管理器中时,有人能指出我缺少什么吗?

谢谢艾尔

4

1 回答 1

1

我认为首先你应该定义一个命名空间

namespace Apps01\ResourceCalBundle\Controller;

正如您的错误在这里告诉您的那样:

“命名空间可能有错字。”

于 2012-10-25T05:10:56.400 回答