How to force download a .csv file in Symfony 2, using Response object?
问题 I'm making a "Download" controller using Symfony 2, that has the sole purpose of sending headers so that I can force a .csv file download, but it isn't working properly. $response = new Response(); $response->headers->set('Content-Type', "text/csv"); $response->headers->set('Content-Disposition', 'attachment; filename="'.$fileName.'"'); $response->headers->set('Pragma', "no-cache"); $response->headers->set('Expires', "0"); $response->headers->set('Content-Transfer-Encoding', "binary");