我正在寻找一个PHP / Symfony代码,根据他的连接位置www.mondomain.fr/fr和www.mondomaine.fr/pt等将用户重定向到另一个链接......我怎么能这样做?我已经把它包含在我的道路中了:
/**
* @Route("/{_locale}", name="homepage")
*
*/
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$boutton = $em->getRepository('AppBundle:Boutton')->findAll();
$image = $em->getRepository('AppBundle:Images')->findAll();
// replace this example code with whatever you need
return $this->render('default/index.html.twig', array(
'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'boutton' => $boutton,
'images' => $image
));
}
谢谢