Setting index route in Symfony 2

前端 未结 6 929
孤街浪徒
孤街浪徒 2021-01-22 00:59

I\'ve got Symfony2 installed, and a mostly working site, the only issue is I don\'t know how to set a default route. Currently, I access my index and other routes with the follo

6条回答
  •  旧时难觅i
    2021-01-22 01:39

    I solved this problem by just removing the following from routing_dev.yml

    _welcome:
        pattern:  /
        defaults: { _controller: AcmeDemoBundle:Welcome:index }
    

    That is assuming you have setup a default / route in a routing.yml file or by defining the route in a controller like:

    /**
     * @Route("/")
     * @Template()
     */
    public function indexAction()
    {
        return array('name' => '1');
    }
    

提交回复
热议问题