我需要从 html 表导出到 excel 文件,但是当我读取 de xml 文件时遇到字符问题..
像这样的东西:
Región should be like Región
Teléfono should be like Teléfono
这是我的标题定义:
header('Content-encoding: UTF-8');
header("Content-type: application/x-msexcel; charset=UTF-8");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-disposition: attachment; filename=" . $nombreArchivo . ".xls");
有一个 BOM 配置,但不知道如何在标题中设置
非常好
我只是在标题结束之前应用此代码
echo "\xEF\xBB\xBF";
这解决了“特殊字符”的问题。感谢马里奥 :)
但
现在,当我想打开下载的文件时,我仍然收到此消息:
"The file you are trying to open, 'file.xls', has a different format than specified by the file extension. Make sure the file is not corrupted and is from a trusted source before opening. Do you want to open the file now?"
有什么避免该消息的想法吗?