看板 PHP 關於我們 聯絡資訊
※ 引述《love417 (一直在找一個人)》之銘言: : 網頁建置是用appserv : 可是放上server的時候卻跑出這樣的錯誤 : Warning: Cannot modify header information - headers already sent by (output : started at C:\Inetpub\wwwroot\breeder\login.php:2) in : C:\Inetpub\wwwroot\breeder\login.php on line 9 : Warning: Cannot modify header information - headers already sent by (output : started at C:\Inetpub\wwwroot\breeder\login.php:2) in : C:\Inetpub\wwwroot\breeder\login.php on line 10 : server上 : 平台是2000 server版 : php-4.3.11 : mysql-4.0.24 : 下面附上原始檔 : <?php : mysql_connect ("localhost", "xxxxx", "xxxxx"); : mysql_select_db("mytest"); : $sql="select user,passwd from t7 where user='$userid' and passwd='$passwd'" : ; : $result=mysql_query($sql); : $num=mysql_num_rows($result); : if($num>0){ : setcookie("username",$userid); : header("location:frameset-1.htm"); : }else{ : echo" 沒$userid這個人!!"; : }; : ?> : 直覺上應該是設定有錯 : 可是又不知道去改哪@@" 呃...自己回應一下 我同學在別的論壇幫我問了 解決的方法為在程式前後加上 ob_start();跟ob_end_flush(); 用了的確可以跑了 ̄□ ̄ 查了一下書這個指令是暫存用的 為啥這樣就可以跑啊... -- , , ., . -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.120.98.132