我正在開發一個PHP項目,登錄後似乎有頭問題。 我的根文件夾中有PHP標頭不工作,試了一下
Login -> index.php
Register -> index.php
index.php
如果登錄成功,
header("Location: ../index.php");
它不帶我去根索引文件。而是停留在同一頁面上。 它可以正常工作
header("Location: ../register");
我是否缺少以下代碼?
if ($check>0) {
$row = mysqli_fetch_assoc($run);
$_SESSION['email']=$row['user_email'];
header("url: ../index.php");
}
你能解釋一下嗎? –
當你在php文件中按下不必要的'Enter'(這是新行)時,就會出現這種情況。只需從頁面的第1行開始你的php代碼。 – Siraj