我正在与Symfony一起进行第一个项目时,创建了第一个控制器。并且出现此错误。
我尝试过
作者更新
而且我遇到了同样的问题!The problem that appear when i update the composer
这里是TestController.php的代码
<?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 TestController extends Controller {
/**
* @Route("/")
* @Method ({"GET"})
*/
public function index()
{
//return new Response('<html><body>Hello world</body></html>');
return $this->render('articles/index.html.twig');
}
}
index.html.twig文件上只有<h1> test </h1>
是什么使该问题出现?以及如何在不删除项目并再次创建的情况下进行修复!谢谢
[Symfony\Bundle\FrameworkBundle\Controller\Controller
分别为deprecated since v4.2.0和removed since v5.0.0,请改用Symfony\Bundle\FrameworkBundle\Controller\AbstractController
。
<?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\AbstractController;
class TestController extends AbstractController {
/**
* @Route("/", methods={"GET"})
*/
public function index()
{
//return new Response('<html><body>Hello world</body></html>');
return $this->render('articles/index.html.twig');
}
}