1

在 wamp 服务器上安装 symfony3 可以使用 composer

http://localhost:9080/SymfonyApp/web/

我得到了欢迎页面,那很好

在 C:\wamp\www\symfonyApp\src\AppBundle\Controller 中创建了如下所示的 todocontroller.php

#

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class TodoController extends Controller
   {
/**
 * @Route("/todos", name="todo_list")
 */
public function indexAction(Request $request)
{
    die('TODOS');
    // replace this example code with whatever you need
    return $this->render('default/index.html.twig', [
        'base_dir' =>
 realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
    ]);
    } 
 }
#

当我去http://localhost:9080/SymfonyApp/web/todos

我应该在浏览器上看到 TODOS,但我收到 404 错误

有人可以告诉我路线有什么问题吗?

4

0 回答 0