2017-07-25 202 views
2

服務器遇到內部錯誤,無法完成您的請求。服務器超載或CGI腳本中出現錯誤。 如果您認爲這是服務器錯誤,請與網站管理員聯繫。 錯誤500 本地主機 的Apache/2.4.25(Win32的)的OpenSSL/1.0.2j PHP/30年6月5日XAMPP服務器錯誤(錯誤500)

我打開日誌錯誤,並發現問題是關於頭()我有我的user.inc.php:

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{ 



    } 
} 
} 

錯誤日誌:

[星期二10年7月25日:26:58.464402 2017] [HTTP:錯誤] [2380 PID:TID 1656] [客戶端: :1:49602] AH02429:響應標題名稱'位置'包含英寸有效字符,中止請求,推薦人:http://localhost/tgss/index.php

請幫忙。

回答

2

更改此

header("Location : index.php?loginsuccess"); 

這個

header("Location: index.php?loginsuccess"); 

錯誤來自Location和結腸(:)之間的空間。

我測試你的header("Location : index.php?loginsuccess");的冒號(:)之間有空間,而且還返回Error 500

+0

媽呀,非常感謝你。 我是新的PHP –