Header('Location:Index.php');在服务器上不工作

时间:2019-02-09 07:44:58

标签: php http-redirect

我在php中的标头语句遇到问题,它在我的本地主机上运行良好,但是当我在线托管它时,标头功能不再起作用?这是我的代码:

    <?php

        if(isset($_POST['clsub']))
        {

        $classname = $_POST['carlist'];
        $Title = $_POST['Title'];
        $Descrip = $_POST['Descrip'];
        $Due8 = $_POST['Due8'];
        $textbook = $classname.": ".$_POST['textbook'];
        if($_POST['folder'] == "folder"){    
        $folder = $classname.": ".$_POST['folder'];
        }else{
            $folder = $_POST['folder'];
        }
        if($_POST['textbook'] == "textbook"){    
            $textbook = $classname.": ".$_POST['textbook'];
        }else{
            $textbook = $_POST['textbook'];
        }
        $online = $_POST['online'];
        $d4 = substr($Due8, 5, -3);
        $d2 = substr($Due8, 8, 10);
        $d3 = substr($Due8, 0, 4);
        $finDu = $d2 ."/". $d4 ."/" . $d3;

        $sql = "INSERT INTO classes (classname, Title, Due, descrip, Book, Folder, Laptop) VALUES ('$classname', '$Title', '$finDu', '$Descrip', '$textbook', '$folder', '$online')";

        $result = mysqli_query($conn,$sql);
        header('Location: Index.php');
        }

    ?>

任何帮助都会很棒!! PS:我知道这对sql注入开放,这只是概念的证明:)

0 个答案:

没有答案