Php 为什么标头函数没有';你不能正常工作吗?

Php 为什么标头函数没有';你不能正常工作吗?,php,html,Php,Html,我正在做一个项目,我想制作一个本地网页。它是用PHP制作的这个网站。但是我有一些问题。在登录部分输入电子邮件和密码后,代码必须重定向到网站主页,但它不会这样做。我提到网站的每个页面都组织在一个文件夹中。例如,下面是一些文件夹:Main、Login、Register等。我将代码放在下面,看看重定向功能有什么问题 矿物世界/Main/Main.php <html> <link rel="stylesheet" href="designMain.

我正在做一个项目,我想制作一个本地网页。它是用PHP制作的这个网站。但是我有一些问题。在登录部分输入电子邮件和密码后,代码必须重定向到网站主页,但它不会这样做。我提到网站的每个页面都组织在一个文件夹中。例如,下面是一些文件夹:Main、Login、Register等。我将代码放在下面,看看重定向功能有什么问题

矿物世界/Main/Main.php

<html>
    <link rel="stylesheet" href="designMain.css">
    <head>
        
        <link rel="icon" href="/Mineral-World/Main/More/icon.png" >
        <title>Mineral-World</title>

    </head>

    <body>
    
    <div class="topnav">
        <a href="/Mineral-World/Main/Main.php">Home</a>
        <a href="/Mineral-World/Buy/Buy.php">Buy</a>
        <a href="/Mineral-World/Sell/Sell.php">Sell</a>
        <a href="/Mineral-World/Information/Information.php">Information about minerals</a>
        <a style="margin-left:750px;" href="/Mineral-World/Register/Register.php">Register</a>
        <a href="/Mineral-World/Login/Login.php">Login</a>
    </div>

    

    <div class="stylename"> Welcome </div>

    <div class="stylename3" >
        <div class="card1" style="margin-left: 20px;float:left;">
            <div class="stylename1" style="margin-left: 50px;"> What is Mineral-World?</div>
            <div class="stylename2" style="margin-left:15px;"> We are an online market and here you can buy or sell minerals. You will find the best offers!</div>
        </div>
        <div class="card1" style="float:right;">
            <div class="stylename1" style="margin-left: 50px;"> Are any taxes to be paid?</div>
            <div class="stylename2" style="margin-left:15px;"> You can sell or buy minerals without any cost, including the registering process.</div>
        </div>
    </div>

    </body>

</html>

矿物世界
欢迎
什么是矿物世界?
我们是一个在线市场,您可以在这里买卖矿物。你会发现最好的报价!
要交税吗?
您可以免费出售或购买矿物,包括注册过程。
矿物世界/Login/sessionLogin.php

<?php

    include("ConnectBD_Login.php");
    session_start();
    if(isset($_POST['email'])&&isset($_POST['password']))
    {
        $email=$_POST['email'];
        $pass=md5($_POST['password']);
        $sel="select user from users where email='$email' and pass='$pass'";
        $que=mysql_query($sel);
        if(mysql_num_rows($que)==1)
        {
            $rez=mysql_fetch_row($que);
            $_SESSION['user']=$rez[0];
            header("Location: D:\EasyPHP-5.3.8.1\www\Mineral-World\Main\Main.php");
            exit();
        }
        else{
            $_SESSION['neconect']="Email or password is incorrect!";
            header();
            exit();
        }
    }else {
        $_SESSION['neconect']="Email or password is incorrect!";
        header();
        exit();
    }
    mysql_close();
?>

您的头位置必须是url,而不是文件路径,请尝试以下操作:

header("Location: ../../Main/Main.php");

标头必须指向URL,而不是本地驱动器上的文件。您还有两个对
header()
的调用,没有参数。如果您刚刚开始学习PHP,我强烈建议您使用最新版本。您使用的PHP版本在几年前甚至停止接收安全更新。警告:
mysql\uquot.
扩展从PHP 5.5.0开始就被弃用,从PHP 7.0.0开始就被删除。相反,应该使用或扩展名。在选择MySQL API时,请参阅以获取更多帮助。警告:您完全可以使用参数化的预处理语句,而不是手动生成查询。它们由或提供。永远不要相信任何形式的输入!即使您的查询仅由受信任的用户执行。切勿以明文或使用MD5/SHA1存储密码!仅存储使用PHP创建的密码哈希,然后可以使用进行验证。看看这篇文章:了解更多关于