How can I redirect in PHP without header errors?

前端 未结 7 2123
旧时难觅i
旧时难觅i 2021-02-10 08:04

How can I redirect in PHP with this setup below without getting header output errors, I understand that nothing can be printed to the browser before a header is set, I am lookin

相关标签:
7条回答
  • 2021-02-10 08:32

    Can't you just do this:

    <?php
    validlogin($url); // call the function here
    include ('header.inc.php');
    include ('SOME-FILE-HERE.php');
    include ('footer.inc.php');
    ?>
    

    Or, put the include files in every one of the "SOME-FILE-HERE"-type files, if that's possible, so you end up with:

    <?php
    validlogin($url); // call the function here
    include ('header.inc.php');
    ?>
    
    <h1>Page heading</h1>
    ...page content etc...
    
    <?php
    include ('footer.inc.php');
    ?>
    
    0 讨论(0)
提交回复
热议问题