PHP用header进行文件下载
各位,我用header导出csv,我在本地测试可以成功下载导出,但是在服务器就只能直接显示在网页上了,不能下载,为什么会这样?
我的header是这样的:
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Type: application/vnd.ms-excel");
header("Content-Type: application/force-download");
header("Pragma: public");
header("Accept-Ranges: bytes");
header("Expires: 0");
header('Content-Disposition: attachment;filename="data.csv"');
header("Content-Transfer-Encoding: binary");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Cache-Control: private',false);