【发布时间】:2017-10-15 13:51:41
【问题描述】:
我正在寻找一个 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
));
}
谢谢
【问题讨论】: