$lsh = htmlEncode($_POST["$addr"]);
$sql = "select lsh from huikuan where lsh='".$addr."' limit 1";
$query = $mysqli->query($sql);
$rs = $query->fetch_array();
if($rs['lsh']){
message('已经入账无法重复入账');
}各位前辈 例如原来返回的地址是 xxx.php?12255   再次刷新后弹出以上代码  弹出后返回的是依然是xxx.php  如何能直接返回首页或者直接关闭呢  

解决方案 »

  1.   

    header('Location: http://www.example.com/');
    跳转到 http://www.example.com$lsh = htmlEncode($_POST["$addr"]);
    $sql = "select lsh from huikuan where lsh='".$addr."' limit 1";
    $query = $mysqli->query($sql);
    $rs = $query->fetch_array();
    if($rs['lsh']){
    message('已经入账无法重复入账');
    header('Location: http://www.example.com/');
    }
      

  2.   


    $lsh = htmlEncode($_POST["$addr"]);
    $sql = "select lsh from huikuan where lsh='".$addr."' limit 1";
    $query = $mysqli->query($sql);
    $rs = $query->fetch_array();
    if($rs['lsh']){
    message('已经入账无法重复入账');
    echo '<script type="text/javascript">window.location="index.php";</script>';
    }
      

  3.   

    帮你总结一下:
    方法一:header("Location: index.php"); 
    方法二:echo "<script>window.location =\"index.php\";</script>"; 
    方法三:echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php\">"; 
    下面一个为另类点的:
    方法四:<?php
    ob_start();
    ?>
    html代码
    <?
    ob_clean();
    include("next.php");
    ob_end_flush();
    ?>
      

  4.   

    header("Location: index.php");
    使用header跳转不行,因为他要使用js弹出提示信息,所以只能使用js的window.location.href来重定向。