Multiple pattern in single symfony routing

后端 未结 4 1209
萌比男神i
萌比男神i 2020-12-29 04:41

How to make multiple pattern in single Symfony routing?

Normally we have a routing as

blog:
    pattern:   /
    defaults:  { _controller: AcmeBlogB         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 05:07

    Are you using Symfony2? If you are and can use annotations for your routing instead of yml or xml then it's possible to have multiple routes defined along these lines:

    /**
    * @Route("/");
    * @Route("/home");
    */
    

    Then you don't need to duplicate the action method.

提交回复
热议问题