Re: [請益] win下用.php備份mysql某資料表轉成excel檔

看板PHP作者 (iamcat)時間17年前 (2008/09/05 04:33), 編輯推噓1(105)
留言6則, 3人參與, 最新討論串2/2 (看更多)
又要麻煩大家了,下面這是怎麼回事?? 該改成怎樣子呢? 如果我照 Yahoo知識加 這個來做的話 http://0rz.tw/dd4Jp 會出現 ========= Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\myPage\SAwarddata\big5\admin.php:8) in C:\AppServ\www\myPage\good\big5\show.php on line 94 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\myPage\SAwarddata\big5\admin.php:8) in C:\AppServ\www\myPage\good\big5\show.php on line 96 =================== 出現錯誤 而 94 96 行 是.. if ($_POST['Mode'] == "OutFile"){ header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=backup.xls"); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.128.135

09/05 10:20, , 1F
意思就是在那之前已經有東西輸出了..
09/05 10:20, 1F

09/05 13:04, , 2F
你是說 backup.xls 已經輸出了嗎?? 可是我找不到這
09/05 13:04, 2F

09/05 13:05, , 3F
檔案耶..@@
09/05 13:05, 3F

09/05 16:02, , 4F
請把 HTML 那部分放到檔案最下方
09/05 16:02, 4F

09/05 16:03, , 5F
或者你可以參考說明文件的 ob_start、ob_end_flush
09/05 16:03, 5F

09/05 16:04, , 6F
更快的方法到 php.ini 將 output_buffering = On
09/05 16:04, 6F
文章代碼(AID): #18m4O56k (PHP)
文章代碼(AID): #18m4O56k (PHP)