PHP标头无法托管

时间:2015-12-05 04:03:37

标签: php

我知道这个问题已经在问题清单上了。我尝试了所有人的答案,但它并没有帮助我一点点。头函数在localhost上工作正常,但是当我将文件上传到服务器时,标题行不起作用。我厌倦了一次又一次地做出改变。我需要你的帮助。请!

<?php 
    session_start();    
    $name = $_POST['Username'];
    $pass = $_POST['Password'];
    if(isset($_POST['Submit'])){
    if((isset($name) && isset($pass))){

    include 'connection.php';

    $sql = "select * from `users` where username='$name' AND password='$pass' ";
    $result = mysqli_query($conn, $sql); 

    if(mysqli_num_rows($result) > 0){
        while($row = mysqli_fetch_assoc($result)) {
        $_SESSION['login_user'] = $row["username"];
        $_SESSION['login_user_pass'] = $row["password"];

        header('Location: ../php/businesshome.php'); // Redirecting To Other Page
    }   
        }
         else {
            $error = "Username or Password is invalid";
        } 
    }
}
    mysqli_close($conn);
?>

1 个答案:

答案 0 :(得分:0)

最后我得到答案。 header('Location: ../php/businesshome.php');中有一个空格。消除空间后它工作正常。