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 | 豬窩

It's not my first time to visit this website, i am
browsing this web page dailly and take fastidious facts from
here every day.

作者 best web hosting sites @ 12:37, 2020-07-18

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

I'm not sure where you're getting your info, but good topic.
I needs to spend some time learning much more or understanding more.
Thanks for magnificent information I was looking for this information for my mission.

作者 web hosting providers @ 08:19, 2020-07-22

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

I simply could not leave your website before suggesting that I
actually loved the usual info a person supply on your visitors?

Is going to be again often in order to inspect new posts

作者 web hosting companies @ 10:09, 2020-07-23

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

I've been exploring for a bit for any high-quality articles or blog
posts on this kind of house . Exploring in Yahoo I ultimately stumbled upon this
site. Reading this info So i am happy to express
that I have a very good uncanny feeling I discovered exactly what I needed.
I most without a doubt will make certain to don?t omit this web site and provides it a glance on a continuing
basis.

作者 best web hosting 2020 @ 08:16, 2020-07-26

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

Wow! After all I got a blog from where I know
how to in fact take useful data concerning my study and knowledge.

作者 web hosting providers @ 04:38, 2020-07-27
發表迴響
 authimage