when i download a CSV file on Firefox browser then detect it is Zip file (must be CSV)
I want to it is CSV file.
this is my the code
<?php
$filename = 'example.csv';
header('Cache-Control: public');
header('Pragma: public');
header('Content-Type: application/csv; name="' . $filename. '"');
header("Content-Disposition: attachment; filename*=UTF-8''" . rawurlencode($filename));
$th = array();
$th[] = "名前";
mb_convert_variables('SJIS','UTF-8',$th);
$out = fopen('php://output', 'w');
fputcsv($out, $th);
fclose($out);
ob_get_contents();
ob_flush();
flush();
CodePudding user response:
But I don't understand yet why adding exit()
has this working properly
CodePudding user response:
This "error" is related to your computer file open configuration. Maybe you checked the option to assign .csv files to this zip software, but, is easy to change the software and set another one.