headers already sent by php ERROR :|
headers already sent by php ERROR :|
我在 php 上的以下代码有问题 :(
<?php echo $_GET["u"];
$servername = "localhost";
$username = "******";
$password = "*****?";
$dbname = "*****";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$tt=$_GET["u"];
$sql = "SELECT url from code WHERE BINARY short="."'$tt'";
$result=$conn->query($sql);
$data=$result->fetch_assoc();
$url="Location: ".$data["url"];
header($url); /* Redirect browser */
exit();
?>
我在这一行的问题:(
header($url); /* Redirect browser */
$url 变量是 link 从数据库中获取的变量。!
嗯,这不是说谎。您的脚本顶部有 echo $_GET["u"];
。
发送前必须没有任何输出 headers。
我在 php 上的以下代码有问题 :(
<?php echo $_GET["u"];
$servername = "localhost";
$username = "******";
$password = "*****?";
$dbname = "*****";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$tt=$_GET["u"];
$sql = "SELECT url from code WHERE BINARY short="."'$tt'";
$result=$conn->query($sql);
$data=$result->fetch_assoc();
$url="Location: ".$data["url"];
header($url); /* Redirect browser */
exit();
?>
我在这一行的问题:(
header($url); /* Redirect browser */
$url 变量是 link 从数据库中获取的变量。!
嗯,这不是说谎。您的脚本顶部有 echo $_GET["u"];
。
发送前必须没有任何输出 headers。