Php Symfony:从细枝链接到另一个页面

Php Symfony:从细枝链接到另一个页面,php,symfony,Php,Symfony,控制器中的此代码加载我的第一页: /** * @Route("/main") */ public function indexAction() { $templating = $this->container->get('templating'); $html = $templating->render('base.html.twig'); return new Response($html)

控制器中的此代码加载我的第一页:

    /**
     * @Route("/main")
     */
        public function indexAction()
    {
        $templating = $this->container->get('templating');
        $html = $templating->render('base.html.twig');

return new Response($html);
    }
我在
my base.html.twig
中有一个链接:

 <a href="{{ path('options') }}">My options</a> 
试试这个:

 /**
 * @Route("/options", name="route-name")
 */
public function showAction() {

    return new Response("This will be options page:");
}
现在使用路线的名称:

  <a href="{{ path('route-name') }}">My options</a> 

添加路线名称:或在路径功能中使用默认名称
  <a href="{{ path('route-name') }}">My options</a>