Header location is not working on live server

前端 未结 4 605
遥遥无期
遥遥无期 2021-01-29 11:58

I Have one registration and payment page. program flow is like registration > confirmation > payment. After validation and calculation in registration page need to go to confirm

相关标签:
4条回答
  • 2021-01-29 12:30
    $host  = $_SERVER['HTTP_HOST'];
    $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    $extra = 'confirm.php';
    header("Location: http://$host$uri/$extra");
    
    0 讨论(0)
  • 2021-01-29 12:33

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

    Also try to change header('Location:confirm.php'); (Note L is capital since its work in your local server may be problem with strict php type try this once)

    0 讨论(0)
  • 2021-01-29 12:39

    i had the same issues for years but today i discovered that u don't have to have any html or blank space before the header word .Try it out

    0 讨论(0)
  • 2021-01-29 12:46

    use ob_end_flush() at the end. This should work like charm.

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