I am new to symfony and maybe I am missing something really simple but I am not able to spot it. Any help will be much appreciated. I have these two files:
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>');
}
}
Yet when I point my browser to http://example.com/Symfony/web/app_dev.php/resourcecalendar/login I get the following error:
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
Can someone point out what I am missing when I can see that the class LoginController
is definitely there inside the filer?
Thanks Al
I think first of all you should define a namespace
namespace Apps01\ResourceCalBundle\Controller;
as your error told you here:
"namespace probably has a typo."
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.