PHP utf-8 用 header 檔案下載 word error
以前在 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 | 豬窩
Hey would you mind letting me know which webhost you're working with?
I've loaded your blog in 3 completely different web browsers and I must say this blog loads a
lot faster then most. Can you recommend a good web hosting
provider at a fair price? Thanks a lot, I appreciate it!
PHP utf-8 用 header 檔案下載 word error | 豬窩
Hi, Neat post. There is a problem with your web site in web explorer, would test this?
IE nonetheless is the market leader and a good
section of people will pass over your great writing due to this problem.
PHP utf-8 用 header 檔案下載 word error | 豬窩
I do trust all the ideas you've offered for your post.
They are very convincing and can certainly work. Still, the
posts are very brief for newbies. Could you please lengthen them a little from
next time? Thank you for the post.
PHP utf-8 用 header 檔案下載 word error | 豬窩
Hey! This is kind of off topic but I need some guidance from an established blog.
Is it very hard to set up your own blog? I'm not very techincal but I can figure
things out pretty fast. I'm thinking about setting up my own but I'm not sure where to begin. Do you have any
ideas or suggestions? Thanks
PHP utf-8 用 header 檔案下載 word error | 豬窩
Wow that was odd. I just wrote an incredibly long comment but after I clicked submit my
comment didn't appear. Grrrr... well I'm not writing
all that over again. Anyway, just wanted to say wonderful blog!