Routing in Symfony2

前端 未结 10 1792
抹茶落季
抹茶落季 2021-02-05 04:30

How to setup default routing in Symfony2?

In Symfony1 it looked something like this:

homepage:
  url:   /
  param: { module: default, action: index }

de         


        
10条回答
  •  半阙折子戏
    2021-02-05 05:00

    Here is an example: http://docs.symfony-reloaded.org/master/quick_tour/the_big_picture.html#routing

    A route definition has only one mandatory parameter pattern and three optionals parameters defaults, requirements and options.

    Here's a route from my own project:

    video:
        pattern:  /watch/{id}/{slug}
        defaults: { _controller: SiteBundle:Video:watch }
        requirements: { id: "\d+", slug: "[\w-]+" 
    

提交回复
热议问题