Loading...

PHP輸出到WORD跟EXCEL 簡易做法

Temperature: 0 °C

Mark ChangMark Chang
author_tools


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
PHP

Prev
 解決svchostexe消耗記憶體問題

Next
修改php設定 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

如何將 a href 禁用

如何將 a href 禁用

如標題,若採用CSS的方式作法如下: .disabled { pointerevents: none...

.htaccess設定網站預設首頁次序

.htaccess設定網站預...

一般php空間預設設定是index.php為首頁。 所以如果網站用index.php做首頁,就不需要...

解決iphone 不能使用colorbox 滑動的方式

解決iphone 不能使用c...

pexelsphotoiphone #cboxLoadedContent, #cboxContent...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format