資料載入中

胡言亂語

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

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

ajax錯誤訊息提示

ajax錯誤訊息提示

Mark Chang 7 年又 202 天 1.3K

ajax目前已經是我寫系統使用非常普遍的方式~ 雖說常寫,但偶爾還是會有鬼打牆的時候發生.......

WordPress如何關閉迴響留言功能?

WordPress如何關閉迴…

Mark Chang 6 年又 85 天 2.1K

其實WordPress本身的留言迴響功能還蠻健全的。 包括可以設定關鍵字黑名單或者是IP黑名單,強制...

如何將 a href 禁用

如何將 a href 禁用

Mark Chang 4 年又 220 天 1.6K

如標題,若採用CSS的方式作法如下: 接著在連結裡加入上列CSS 以上紀錄~