我是symfony的新手,也许我错过了一些非常简单的东西,但我无法发现它。任何帮助都感激不尽。我有这两个文件:
C:\ XAMPP \ htdocs中\的Symfony \ SRC \ Apps01 \ ResourceCalBundle \资源\配置\ routing.yml中
ResourceCalendar_Login:
pattern: /resourcecalendar/login
defaults: { _controller: AppsRollerResourceCalBundle:Login:DisplayLogin }
C:\ XAMPP \ htdocs中\的Symfony \ SRC \ Apps01 \ ResourceCalBundle \控制器\ 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
绝对存在于文件管理器中时,是否可以指出我缺少的内容?
由于 人
答案 0 :(得分:1)
我认为首先应该定义命名空间
namespace Apps01\ResourceCalBundle\Controller;
正如你的错误告诉你的那样:
“命名空间可能有拼写错误。”