Ms7 Search
Google 搜尋 翻譯
calendar
« 九月 2024 »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
近期文章
文章分類
網站連結
Syndicate

« | »

PHP utf-8 用 header 檔案下載 word error

2013-03-08 @ 23:30 in 學校網頁

以前在 big5 網頁用

header("Content-Type: application/force-download; name=\"".$file."\""); //==> 當你存檔的時候正確顯示你的檔名
header("Content-Disposition: attachment; filename=\"".$file."\""); //==> 當你存檔的時候正確顯示你的檔名
header("Content-Transfer-Encoding: binary");
readfile($df);

可以下載 word 或 pdf 的檔案

可是改成 utf-8  網頁時,下載 word 檔案就顯示無法啟動轉換程式,在網頁上找到有人說是 buffer 的問題,後來看到有人加入清 buffer 的函數,竟然就可以了,將指令修改如下

header("Content-Type: application/force-download; name=\"".$file."\""); //==> 當你存檔的時候正確顯示你的檔名
header("Content-Disposition: attachment; filename=\"".$file."\""); //==> 當你存檔的時候正確顯示你的檔名
header("Content-Transfer-Encoding: binary");
ob_clean();
flush();

readfile($df);

 

迴響

PHP utf-8 用 header 檔案下載 word error | 豬窩

Informative article, just what I was looking for.

作者 cheap flights uk @ 17:51, 2020-07-27

PHP utf-8 用 header 檔案下載 word error | 豬窩

Your style is so unique compared to other people I've read stuff from.
I appreciate you for posting when you've got the opportunity, Guess I will just book mark this page.
adreamoftrains best web hosting sites

作者 adreamoftrains website hosting services @ 20:35, 2020-07-30

PHP utf-8 用 header 檔案下載 word error | 豬窩

Hi! I could have sworn I've been to this website before but after browsing through some of the post
I realized it's new to me. Nonetheless, I'm definitely glad
I found it and I'll be bookmarking and checking back often!

作者 scyscanner com @ 11:24, 2020-07-31

PHP utf-8 用 header 檔案下載 word error | 豬窩

Nice weblog here! Additionally your site lots up fast!
What host are you using? Can I get your affiliate link
in your host? I wish my website loaded up as quickly as yours lol

作者 content hosting @ 03:56, 2020-08-06

PHP utf-8 用 header 檔案下載 word error | 豬窩

That is really fascinating, You are an overly skilled blogger.
I've joined your feed and sit up for in the hunt for more of your
wonderful post. Additionally, I've shared your website in my social networks

作者 website hosting companies @ 16:30, 2020-08-07
發表迴響
 authimage