-1

Here is my code,

class LoginController
{
    public function authUser()
    {
        return "OK";
        exit();
    }
}

Its redirect to 404. But if I use below code its working, what's wrong in first code.

class LoginController
{
    public function authUser()
    {
        return $this->render('test.html.php', array());
    }
} 
saravanan mp
  • 745
  • 3
  • 16
  • 34

1 Answers1

0

You need to return an Response object like this :

class LoginController
{
    public function authUser()
    {
        return new Response("OK");
    }
}

https://api.symfony.com/3.4/Symfony/Component/HttpFoundation/Response.html

Flyzzx
  • 458
  • 5
  • 13