Created
October 17, 2017 11:24
-
-
Save whitewhidow/34cafa9244e5a5590c3fd6f90854a75f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function exportCsvAction() | |
{ | |
$data = []; | |
$filename = "export_filename_" . date("Y_m_d_His") . ".csv"; | |
$response = $this->render('BBITAdminBundle:Csv:entity.csv.twig', array('data' => $data)); | |
$response->setStatusCode(200); | |
$response->headers->set('Content-Type', 'text/csv'); | |
$response->headers->set('Content-Description', 'Filename description'); | |
$response->headers->set('Content-Disposition', 'attachment; filename=' . $filename); | |
$response->headers->set('Content-Transfer-Encoding', 'binary'); | |
$response->headers->set('Pragma', 'no-cache'); | |
$response->headers->set('Expires', '0'); | |
$response->sendHeaders(); | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment