How can I redirect in PHP without header errors?

前端 未结 7 2403
悲哀的现实
悲哀的现实 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:18

    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.

提交回复
热议问题