我的控制器中的这段代码加载我的第一页:
/**
* @Route("/main")
*/
public function indexAction()
{
$templating = $this->container->get('templating');
$html = $templating->render('base.html.twig');
return new Response($html);
}
Run Code Online (Sandbox Code Playgroud)
我有一个链接my base.html.twig:
<a href="{{ path('options') }}">My options</a>
Run Code Online (Sandbox Code Playgroud)
当按下链接时,我想使用我的@Route("/options")并转到我的选项页面。问题是如何正确执行此操作?谢谢。
/**
* @Route("/options")
*/
public function showAction(){
return new Response("This will be options page:");
}
Run Code Online (Sandbox Code Playgroud)