看板 PHP 關於我們 聯絡資訊
感謝C大回覆 但是我輸出的CSV都是網頁原始檔 比如說程式碼是 <html> <head> <title>測試</title> </head> <body> <form name="form1" method="post" action=""> <input type="submit" name="button2" id="button2" value="送出"> </form> </body> </html> <?php if(isset($_POST['button2'])){ $F=date ('md'); $Wr=fopen('php://output','w+'); fputcsv($Wr,array('編號','名稱','製作員','尺寸','出廠日','製作日期','製作時間')); header("Content-type:text/x-csv"); header("Content-Disposition:attachment;filename=$F.csv"); }?> ==== 輸出的CSV 變成 編號,名稱,製作員,尺寸,出廠日,製作日期,製作時間 <head> <title>測試</title> </head> <body> <form name="form1" method="post" action=""> <input type="submit" name="button2" id="button2" value="送出"> </form> </body> </html> 請問哪裡出錯了~謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.63.34.193
bibo9901:你跟本搞錯header的意思... 09/14 17:59
chenlarry:header前面不能有任何的輸出.... 09/14 23:31
backfish:你的action要指到另一個專門產生csv檔的程式啦 09/16 21:31
koizumisyou:謝謝各位大大,已解決 09/17 01:01