简体   繁体   English

文件格式和 filename.xls 的扩展名不匹配。 此文件可能已损坏且不安全

[英]The file format and the extension of filename.xls don't match. This file could be corrupted and unsafe

I had made a PHP script to output an excel(.xls) document from data extracted from MySQL database.我制作了一个 PHP 脚本来从 MySQL 数据库中提取的数据输出一个 excel(.xls) 文档

Exporting function is working fine.导出功能工作正常。

The problem is when i open it on MS Excel it shows me following message before opening the file.问题是当我在 MS Excel 上打开它时,它会在打开文件之前显示以下消息。

The file format and the extension of filename.xls don't match.文件格式和 filename.xls 的扩展名不匹配。 This file could be corrupted and unsafe...此文件可能已损坏且不安全...

can you help me to resolve this warning message issue?你能帮我解决这个警告信息问题吗?

excel warning message: excel警告信息:

excel警告信息

array to be exported to excel:要导出到excel的数组:

要导出到excel的数组

exported file:导出的文件:

导出文件

you may change the extension to .xlsx, as MS Office 2013 or newer versions expects that as standard.您可以将扩展名更改为 .xlsx,因为 MS Office 2013 或更新版本希望将其作为标准。 Also try to use exact mime type when exported from php.从 php 导出时,也尝试使用精确的 mime 类型。 you may search for mime types and test which meets your office installation.您可以搜索适合您办公室安装的 mime 类型并进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM