我在jquery中有一个表我想在csv,pdf,excel中导出这个表我在我的控制器中尝试了这个方法: 但她显示页面ok.twig.html
的内容public function adminCsvAction() {
$session =$this->get('request')->getSession() ;
$user_name = $session->get('user_name');
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery('SELECT u FROM AdminBlogBundle:AlertesBss2 u where u.cmts IS NULL AND NOT EXISTS (SELECT p.cmts FROM AdminBlogBundle:DarkCell p WHERE p.cmts != u.cmts)');
$listes = $query->getResult();
$filename = "export_".date("Y_m_d").".csv";
$response = $this->render('AdminBlogBundle:GestionAlerte:ok.html.twig', array('listes'=>$listes));
$response->headers->set('Content-Type', 'text/csv');
$response->headers->set('Content-Disposition', 'attachment; filename='.$filename);
return $response;
} 谁可以帮助我