当我尝试重定向到php中的新位置时,我得到了;无法修改标题信息已发送的标题错误“;
在到达header()指令之前的某个时刻,已经进行了一些输出。您的格式设置混乱,但之前页面的第一个字符可能有空格当我尝试重定向到php中的新位置时,我得到了;无法修改标题信息已发送的标题错误“;,php,html,mysql,Php,Html,Mysql,在到达header()指令之前的某个时刻,已经进行了一些输出。您的格式设置混乱,但之前页面的第一个字符可能有空格 <?php include 'conn/condb.php'; if (isset($_POST['submit'])) { if (isset($_POST['username'])and isset($_POST['password'])) { $username = $_POST['username']; $password =
<?php
include 'conn/condb.php';
if (isset($_POST['submit'])) {
if (isset($_POST['username'])and isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysql_query("SELECT username,password FROM login WHERE`username='$username'AND password='$password'");
if (!$query)
die("Database access failed: " . mysql_error());
$rows = mysql_num_rows($query);
if (($username == 'admin') && ($password == 'keystech')) {
$_SESSION['username'] = $username;
$_SESSION['sid'] = session_id();
header("location:index1.php");
} else {
echo "<script type='text/javascript'>alert('Please Enter Your Correct user name And Password..')</script>";
echo '<script type="text/javascript">window.location="index.html";
</script>';
}
}
}
?>
在你的之后,做几件事
在之后添加ob\u start
,很抱歉格式不好。。谢谢你的回复。我已尝试添加ob_start();然后死。。但是我仍然面临着同样的错误。首先,检查是否到达了正确的部分,意味着您是否到达了header()
部分,进行一些分步测试抱歉格式错误。。。在我的实际代码中没有空格。。。
<?php