我從下面的代碼收到以下錯誤,我不完全知道爲什麼。如果你能告訴我如何解決這個問題,那會很棒。先謝謝了。
警告:不能更改頭信息 - 頭已經發出(輸出開始...)上線45
<?php
// Initialization
$conn = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME, $conn);
// Error checking
if(!$conn) {
die('Could not connect ' . mysql_error());
}
// Localize the GET variables
$ref = isset($_GET['ref']) ? $_GET['ref'] : "";
// Protect against sql injections
// Insert the score
$retval = mysql_query("INSERT INTO $table(
site
) VALUES (
'$ref'
)",$conn);
if($retval) {
echo "Successfull";
} else {
echo "Unsuccessfull " . mysql_error();
}
mysql_close($conn);
?>
<?php
$url = $_GET['url'];
$loc = 'Location: '. $url;
header($loc);
exit;
?>
http://stackoverflow.com/search?q=Cannot%20modify%20header%20%20information或http://www.google.com/search?q=cannot+修改+報頭+報信息 – mario 2011-04-11 18:46:39