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

使用JavaScript的split函式完成字串切割

使用JavaScript的s...

使用JavaScript的split 函式可以用來切割字串。 根據設定的切割點執行切開的動作。 以下...

php在windows系統下無法使用mb_send_mail寄信?

php在windows系統下...

首先,mbsendmail是php所提供可用來發送編碼的郵件。 一般來說會導致無法發送郵件大部分原因...

如何將 a href 禁用

如何將 a href 禁用

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

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