我在 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;
} 谁能帮我