header location not working in my php code

前端 未结 15 886
面向向阳花
面向向阳花 2020-11-28 13:17

i have this code,why my header location not working? its a form of updating and editing and deleting some pages in my control panel...and i have an index.php file in the sam

相关标签:
15条回答
  • 2020-11-28 14:06

    just use ob_start(); before include function it will help

    0 讨论(0)
  • 2020-11-28 14:07

    Remove Space

    Correct : header("Location: home.php"); or header("Location:home.php");

    Incorrect : header("Location :home.php");

    Remove space between Location and : --> header("Location(remove space): home.php");

    0 讨论(0)
  • 2020-11-28 14:07

    I use this

    header("Location:comments.php");
    

    And it solve out..

    0 讨论(0)
  • 2020-11-28 14:08

    That is because you have an output:

    ?>
    <?php
    

    results in blank line output.

    header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP

    Combine all your PHP codes and make sure you don't have any spaces at the beginning of the file.

    also after header('location: index.php'); add exit(); if you have any other scripts bellow.

    Also move your redirect header after the last if.

    If there is content, then you can also redirect by injecting javascript:

    <?php
        echo "<script>window.location.href='target.php';</script>";
        exit;
    ?>
    
    0 讨论(0)
  • 2020-11-28 14:08

    Check if below are enabled

    bz, mbstring, intl, ioncube_loader and Json extension.

    0 讨论(0)
  • 2020-11-28 14:12

    Create config.php and put the code it will work

    0 讨论(0)
提交回复
热议问题