用header()函数跳转,格式header("Location: 路径")

解决方案 »

  1.   

    window.location='/index.php'
      

  2.   


    session_start();
    if (empty($_SESSION['syecmtv'])){
        echo "<script type=\"text/javascript\">alert('请登录'); window.loaction.href='/index.php'</script>";或者$hostroot = dirname(__FILE__). '/../';
    session_start();
    if (empty($_SESSION['syecmtv'])){
        echo "<script type=\"text/javascript\">alert('请登录'); window.loaction.href='{$hostroot}index.php'</script>";
      

  3.   


    建议,在html建议使用根 /aa/bb.html 不过建议你使用统一全局变量 $absolute_path = "/",这样万一以后修改路径 可以统一的修改。如果php include require 包含路径 也要使用绝对路径,可以使用document root 也可以使用入口文件的__FILE__ ,这样路径不会混乱,且include require 效率也会高