symfony3控制器文件出现404错误

时间:2016-11-30 18:40:53

标签: symfony-3.1

使用composer

在wamp服务器上安装symfony3很好

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

我收到欢迎页面,很好

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

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错误

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

0 个答案:

没有答案