导出文件下载,控制台输出乱码
夏日飞霜
夏日飞霜 2020-10-27 16:04:22
[PHP讨论组]

  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)
天蓬老师

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号