下載pdf是ok的,但word就會有問題,
查了半天,
原來是因為在header出來前,
就先用echo輸出資料,
寫入了word的標頭,造成錯誤…
又花了半小時查錯誤,
之前就已經錯過了,也花了好幾個小時找錯誤…
我真該撞牆~~~
//echo $file ; <<就是錯在這,笨!
header("Content-Type: application/force-download");
header('Content-Disposition: attachment; filename='.$file_name);
header("Content-Transfer-Encoding: binary");
readfile($file_path);
exit ;
沒有留言:
張貼留言