将数据导出到excel表格
问题描述:
我已经使用了一些代码,将数据库表格数据导出到使用php的excel表格中。但是,无论何时首先下载文件,都会打开一个错误消息,说明它不支持格式。通过点击是,它会打开并显示我的完整数据,但在表单的最后一页,还会显示页脚。将数据导出到excel表格
代码
<?php
if(isset($_POST['download'])){
// The function header by sending raw excel
header("Content-type: application/vnd-ms-excel");
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=Subscribers.xls");
ob_clean();
// Add data table
include 'data.php';
}
错误
在片差错
我想从excel工作表中删除页脚和打开文件的错误。
尝试'标题( “内容类型:应用程序/ vnd.ms-Excel的;字符集= UTF-8”);' – Ekin
它是给出相同的错误 –
“内容类型:应用程序/ vnd.ms-excel”我写了这个,但没有改变 –