[英]Class "Symfony\Bundle\FrameworkBundle\Controller\Controller" not found while loading "App\Controller\StudentController"
Hi I'm fresher for symfony .嗨,我是 symfony 的新手。 when i execute the below code it will show error.i installed all the assets of symfony.help me to clear this..!
当我执行下面的代码时,它会显示错误。我安装了 symfony 的所有资产。帮我清除这个..!
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class StudentController extends Controller
{
/**
* @Route("/")
* @Method({"GET"})
*/
public function index()
{
// return new Response(
// '<html><body><h1>HI,Welcome to Tamilnadu</h1></body></html>'
// );
return $this->render('student/index.html.twig');
}
}
I just put "hello" in (student/index.html.twig),and i commented the basic response function and want to run the return this function.我只是在 (student/index.html.twig) 中放了“hello”,我评论了基本的响应函数并希望运行返回这个函数。
Try this:尝试这个:
/**
* @Route("/", name="index")
* @return Response
*/
public function index():Response{
return $this->render('student/index.html.twig');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.