时间:2021-07-01 10:21:17 帮助过:41人阅读
代码如下:
$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);
代码如下:
$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.htmlTechArticle第一段是读文件,下载。 第二段是字符串下载。 代码如下:?php $fileName = "prefs.csv"; header('Content-Type: application/octet-stream'); header('...