How can I redirect in PHP without header errors?

前端 未结 7 2406
悲哀的现实
悲哀的现实 2021-02-10 07:33

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:11

    As long as you have no script output before the header() function you should be fine. Check there are no echo's or whitespace. Also putting ob_start() at the beginning can help. sometimes there is invisible whitespace - changing the format of your document to ANSI or Unicode may help!

    As a note (although I think you already know) header does not terminate the script so the exit() (which you have) is a definite requirement.

提交回复
热议问题