0
我已經使用了一些代碼,將數據庫表格數據導出到使用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」我寫了這個,但沒有改變 –