Tag Archives: CSV

Outputting CSV as a Downloadable File in PHP

Nearly every application you could write in for the business sphere in PHP probably requires some sort of data export, most likely in the CSV format.
The easiest way to provide a downloadable file is by altering the headers and echo’ing the file content. In our case:
<?php
header(“Content-type: text/csv”);
header(“Cache-Control: no-store, no-cache”);
header(‘Content-Disposition: attachment; filename=”filename.csv”‘);
We want to set our [...]