Add more than one parameter in Twig path

后端 未结 2 944
悲&欢浪女
悲&欢浪女 2021-01-30 11:53

How to add more than one parameter in Twig path?
Say you have this route :

article_show:
    pattern:  /article/{slug}
    defaults: { _controller: AcmeArtic         


        
2条回答
  •  面向向阳花
    2021-01-30 12:58

    Consider making your route:

    _files_manage:
        pattern: /files/management/{project}/{user}
        defaults: { _controller: AcmeTestBundle:File:manage }
    

    since they are required fields. It will make your url's prettier, and be a bit easier to manage.

    Your Controller would then look like

     public function projectAction($project, $user)
    

提交回复
热议问题