The first paragraph is to read the file and download it.
The second paragraph is string download.
Copy code The code is as follows:
$fileName = "prefs.csv";
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $fileName);
header('Content-Transfer-Encoding: binary' );
header('Content-Length: ' . filesize($fileName));
readfile($fileName);
Copy code The code is as follows:
$fileName = "pref_" . date("YmdHis ") . ".csv";
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $fileName);
echo $csv;
http://www.bkjia.com/PHPjc/621682.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/621682.htmlTechArticleThe first paragraph is to read the file and download it. The second paragraph is string download. Copy the code The code is as follows: ?php $fileName = "prefs.csv"; header('Content-Type: application/octet-stream'); header('...