我正在使用以下代码在Sympony 2.0中生成CSV文件。
$filename = "file.csv";
$response = $this->render('propesqBundle:Relatorio:' . $session->get('idRelatorio' . $key) . '.csv.html.twig', array('rows' => $session->get('resultado' . $key)));
$response->headers->set('Content-Type', 'Content-type: application/octet-stream; charset=UTF-8');
$response->headers->set('Content-Disposition', 'attachment; filename=' . $filename);
return $response;
但是,当我打开文件时,单词&
替换为&
,单引号'
替换为'
。