I created an .csv export file with code:
header('Content-type: text.csv');
header('Content-Disposition: attachment; filename=filename.csv');
.....
$fp = fopen('php://output','w');
foreach ($rowsCsv as $rowCsv) {
fwrite($fp, $rowCsv);
}
fclose($fp);
It work ok but I want to compress the csv file to zip file and download it. How do it
You should read a CSV file before exported, or you only need put
filename.csvinto file:PHP.NET reference how to using ZIP archive: http://php.net/manual/en/class.ziparchive.phpž
Put instead of
addFileadd as string as example: