How Generating URLs from a template correctly in Symfony2/Twig

前端 未结 1 573
礼貌的吻别
礼貌的吻别 2020-12-18 18:11

I\'m working with Symfony2 and:

I have this in the routing.yml

_welcome:
    resource: \"@AcmeBundle/Controller/\"
    type:     annotation
         


        
1条回答
  •  感情败类
    2020-12-18 18:40

    You've to add a route name in your controller route annotations as follow,

    /**
     * @Route("/{page}", name="static")
     */
    public function staticAction($page)
    {
        // ... 
    }
    

    You could then call the twig path helper using that name,

    Home
    

    0 讨论(0)
提交回复
热议问题