How can I redirect in PHP without header errors?

前端 未结 7 2137
旧时难觅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:27

    As already mentioned by the others use ob_start() or the output_buffer-setting to buffer the output. Apart from that it's from my point of view not a good practice to output content in the middle of functional code but this is a another topic.

    You can find more information at Google or in this Article about Output Buffering in PHP.

提交回复
热议问题