服务器遇到内部错误,无法完成您的请求。服务器过载或 CGI 脚本中有错误。如果您认为这是服务器错误,请联系网站管理员。错误 500 localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
我打开了日志错误,发现问题出在我的 user.inc.php 中的 header() 上:
function getLogin($conn){
if(isset($_POST['login']))
{
$uid=$_POST['uid'];
$pwd=$_POST['pwd'];
$sql= "SELECT * FROM user WHERE uid='$uid' AND pwd ='$pwd'";
$result=$conn->query($sql);
if (mysqli_num_rows($result) == 1){
if($row = $result->fetch_assoc()){
$_SESSION['id'] = $row['id'];
header("Location : index.php?loginsuccess");
exit();
}
}
else{
}
}
}
错误日志:
[2017 年 7 月 25 日星期二 10:26:58.464402] [http:error] [pid 2380:tid 1656] [client ::1:49602] AH02429:响应标头名称“Location”包含无效字符,中止请求,referer: http: //localhost/tgss/index.php
请帮忙。
原文由 Joshua Nugraha 发布,翻译遵循 CC BY-SA 4.0 许可协议
改变这个
对此
错误来自
Location
和冒号 (:
) 之间的空格。我测试了你的
header("Location : index.php?loginsuccess");
冒号之间有空格(:
),它还返回一个Error 500