Php 如何在Excel中保存html表格
我一直在尝试用PHP以excel格式保存html数据(基本上是导出到excel功能)。我通过将标题改为Php 如何在Excel中保存html表格,php,codeigniter,export-to-excel,Php,Codeigniter,Export To Excel,我一直在尝试用PHP以excel格式保存html数据(基本上是导出到excel功能)。我通过将标题改为 header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$filename"); header("Pragma: no-cache");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
但打开该文件时,会显示一条针对上述Excel2003应用程序的警告。因此,我可以通过修改标题以2008或2010格式保存excel,还是必须使用其他提供此功能的框架,如“PHPExcel”或其他什么。是的,我正在为我的网站使用CodeIgniter
提前感谢。您需要使用一些库来生成Excel表格
如果仅设置所需的内容类型,则Standart HTML输出不会自动转换为指定格式。尝试将MIME类型更改为:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
而不是
application/vnd.ms-excel
我认为它只是使用了适当的内容类型