【问题标题】:headers already sent by php ERROR :| [duplicate]标头已由 php 错误发送:| [复制]
【发布时间】:2016-07-17 00:13:07
【问题描述】:

我在 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 变量是一个从数据库中获取的链接!

【问题讨论】:

  • @FirstOne 对不起,我的英语很弱:(

标签: php html redirect header location


【解决方案1】:

嗯,这不是说谎。您的脚本顶部有 echo $_GET["u"];

在发送标头之前必须没有输出。

【讨论】:

  • 感谢您的回复,但问题仍然存在:(♥
  • 亲爱的朋友 :) 问题解决了,我删除了
    ' '
猜你喜欢
  • 2015-06-17
  • 1970-01-01
  • 2013-05-03
  • 2013-11-24
  • 1970-01-01
  • 1970-01-01
  • 2011-07-04
  • 2022-01-06
相关资源
最近更新 更多