您的位置:首页技术文章
文章详情页

导出文件下载,控制台输出乱码

【字号: 日期:2022-06-04 10:33:47浏览:47作者:猪猪

问题描述

header("Pragma: public");header("Expires: 0");header("Cache-Control:must-revalidate, post-check=0, pre-check=0");header("Content-Type:application/force-download");header("Content-Type:application/vnd.ms-execl");header("Content-Type:application/octet-stream");header("Content-Type:application/download");;header('Content-Disposition:attachment;filename='.$fileName.'');header("Content-Transfer-Encoding:binary");//输出$writer = IOFactory::createWriter($spreadsheet,'Xlsx');$writer->save('php://output');

但是如果

$writer->save('文件名');

就可以直接保存在根目录,但是不能下载

问题解答

回答1:

代码以及错误信息, 截图发出来