資料載入中

胡言亂語

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設定 

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

使用CSS讓Youtube自動適應寬度跟高度

使用CSS讓Youtube自…

Mark Chang 7 年又 276 天 1.7K

在播放Youtube影音的時候,常使用 的方式崁入網頁裡。 例如: 但往往展開的影音卻無法自動...

使用PHP mb_substr 函式,擷取部分字串並記得使用UTF-8。

使用PHP mb_subst…

Mark Chang 7 年又 242 天 2.9K

文字長度太長,一般來說我們可以使用DIV包住字串,再定義DIV的最大高度及最大寬度。 然後使用h...

破版,很醜

破版,很醜

Mark Chang 7 年又 220 天 1.9K

破版......很醜對不對!! 我想這是所有從事網頁設計師的痛~ 這時你需要的是可以輕輕鬆鬆協助...