資料載入中

胡言亂語

PHP輸出到WORD跟EXCEL 簡易做法


PHP輸出到WORD跟EXCEL簡易做法
WORD:
$filename="test.doc";
header('Pragma: public');
header("Content-disposition: attachment; filename=".$filename.";charset=utf-8");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: utf-8');
header("Content-Type: application/vnd.ms-word");

EXCEL:
$filename="test.xls";
header('Pragma: public');
header("Content-disposition: attachment; filename=".$filename.";charset=utf-8");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: utf-8');
header('Content-Type: application/vnd.ms-excel');

 

https://innstory.com/story-PHP輸出到WORD跟EXCEL簡易做法-1533

上一篇
 解決svchostexe消耗記憶體問題

下一篇
修改php設定 

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

mysql 查詢數據資料是否有重複

mysql 查詢數據資料是否…

Mark Chang 8 年又 233 天 2.7K

有沒有試過資料庫裡上萬筆資料卻不知道是不是有重複的數據? 這時你一定要試試這個查詢方法~  

Linux下查詢已安裝的PHP版本

Linux下查詢已安裝的PH…

Mark Chang 6 年又 145 天 1.7K

紀錄PHP在Linux底下版本查詢方式 執行後輸出以下畫面: 除了用 php 指令外,如果 PHP ...

Ubuntu環境下apache 目錄啟動.htaccess 功能

Ubuntu環境下apach…

Mark Chang 6 年又 26 天 3.1K

.htaccess 檔案是目錄層面的設定檔,可以對目錄變更 Apache 的設定。 要使用 .ht...