【发布时间】:2020-12-28 01:40:55
【问题描述】:
我从服务器下载文件,但下载后 excel 或 word 文件损坏。 Pdf、jpg等都可以。
ob_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: ").$att->getType();
header("Content-Disposition: attachment; filename=" . basename($att->getName()));
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
readfile($path);
我拥有的 excel 内容类型 - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
【问题讨论】:
标签: php