我得到了典型的'警告:不能修改標題信息 - 標題已經發送(輸出開始...行14)'。這通常是由於header()方法之前的echo語句造成的,但令人困惑的是,在header()本身之前沒有任何回聲被調用。請你能告訴我輸出的發生位置,以及爲什麼它目前讓我困惑,並且進一步,所以我可以在將來解決這個問題。無法修改標題信息 - 擋板
第14行是內容的div中的一行:
<p>Lorem ipsum...</p>
在先進的感謝,
最大。
<html>
<head>
<title></title>
<!-- CSS -->
<link ... />
</head>
<body class="index not-admin">
<div id="wrapper">
<div id="logo"></div>
<div id="headerInvoice">
</div>
<div id="content">
<form name="signup" action="" method="GET">
<input name="email" type="email" placeholder="Email Address" />
<input type="submit" title="Submit!"/>
</form>
<?php
if($_SERVER['REQUEST_URI'] == '/betas/') {
header('Location:http://betas.maxk.me');
}
if (isset($_GET['email'])) {
$email = $_GET['email'];
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = 'Email Address is invalid.';
}
else {
mysql_connect('localhost', '...', '...');
mysql_select_db('...');
$email = mysql_real_escape_string($email);
if (mysql_num_rows(mysql_query("SELECT * FROM testers WHERE `email_address` = '$email'")) < 1) {
mysql_query("INSERT INTO `testers` (`email_address`,`accepted`) VALUES ('$email','0')");
$error = !mysql_error()? 'Success!' : "We came across an error, please try again! " . mysql_error();
}
else {
$error = 'Sorry, but you have already signed up! Please try emailing me to see if I need any testers through my <a href="http://maxk.me">homepage</a>.';
}
}
echo $error;
}
?>
<br />
<a href="#">Login</a>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
你知道你沒有關閉你的第一個<?php'標籤嗎? – steveoh 2012-03-06 23:19:19