Setting index route in Symfony 2

前端 未结 6 977
孤街浪徒
孤街浪徒 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条回答
  •  爱一瞬间的悲伤
    2021-01-22 01:49

    For me Symfony 4.1.x

    Edit the file

    # app/config/routes.yaml
    index:
        path: /
        controller: App\Controller\YourIndexController::yourIndexFunction
    

    There's App\Controller is the namespace you declare at the start of the Controller class, and after is your class name and method name to route to.

提交回复
热议问题