Php echo函数未显示任何输出

Php echo函数未显示任何输出,php,echo,Php,Echo,header函数将您重定向到新页面,因此您的回音将显示在当前页面中,但您的代码按以下行显示: <?php session_start(); if (isset($_POST["user_name"]) && isset($_POST["user_pwd"])) { include"php/connect_to_mysql.php"; $user_name = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_

header函数将您重定向到新页面,因此您的回音将显示在当前页面中,但您的代码按以下行显示:

<?php
session_start();

if (isset($_POST["user_name"]) && isset($_POST["user_pwd"])) {
    include"php/connect_to_mysql.php";
    $user_name = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_name"]);
    $user_pwd = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_pwd"]);

    $sql = "SELECT * FROM user_ac WHERE user='$user_name' OR email='$user_name' AND pwd='$user_pwd' LIMIT 1";
    $result = mysqli_query($myConnection, $sql);

    if (mysqli_num_rows($result) > 0) {
        echo "Successfully Logged In";
        header("location: login.html?abc=234");
    } else {

    }
} else {

}    

将您重定向到新页面。

标题功能将您重定向到新页面,因此您的回音将显示在当前页面中,但您的代码如下所示:

<?php
session_start();

if (isset($_POST["user_name"]) && isset($_POST["user_pwd"])) {
    include"php/connect_to_mysql.php";
    $user_name = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_name"]);
    $user_pwd = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_pwd"]);

    $sql = "SELECT * FROM user_ac WHERE user='$user_name' OR email='$user_name' AND pwd='$user_pwd' LIMIT 1";
    $result = mysqli_query($myConnection, $sql);

    if (mysqli_num_rows($result) > 0) {
        echo "Successfully Logged In";
        header("location: login.html?abc=234");
    } else {

    }
} else {

}    

将重定向到新页面。

您无法看到回音,因为您要转到另一个页面


作为测试,删除
标题(“location:login.html?abc=234”)
您将看到
回音

您无法看到回音,因为您要转到另一个页面


作为测试,删除
标题(“location:login.html?abc=234”)
您将看到
回音

谢谢您的回复。我也尝试过重定向到同一个页面,但没有成功如果你重定向到任何页面,在删除重定向行后,你将看不到回声。再次感谢您的回复。我也尝试过重定向到同一个页面,但没有成功如果你重定向到任何页面,在删除重定向行后,你将看不到回声。再次感谢您的回复。我还尝试重定向到同一个页面,但在删除重定向行后没有成功。再次感谢您的回复。我还尝试重定向到同一个页面,但在删除重定向行后没有成功。再次感谢