如何从下载文件中删除 BOM 标记?
How remove BOM mark from download file?
我有这个脚本让用户下载文件:
header('Content-Encoding: UTF-8');
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Disposition: attachment; filename=qa_report.xlsx");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
// echo excel file ...
exit;
文件总是有 BOM 标记,我怎么不能删除 BOM 标记?
我解决了这个问题。问题不在于脚本文件编码,而在于其他包含文件,这些文件不是使用没有 BOM 的 UTF8 编码的。
所有包含文件必须使用相同的编码。
我有这个脚本让用户下载文件:
header('Content-Encoding: UTF-8');
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Disposition: attachment; filename=qa_report.xlsx");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
// echo excel file ...
exit;
文件总是有 BOM 标记,我怎么不能删除 BOM 标记?
我解决了这个问题。问题不在于脚本文件编码,而在于其他包含文件,这些文件不是使用没有 BOM 的 UTF8 编码的。 所有包含文件必须使用相同的编码。