How to redirect to another page using PHP

前端 未结 12 1391
粉色の甜心
粉色の甜心 2020-12-02 16:50

I am building a website which includes a login page. I need to redirect the user to their profile page once they\'ve logged in successfully, but I don\'t know how to do that

12条回答
  •  佛祖请我去吃肉
    2020-12-02 17:32

    You could use ob_start(); before you send any output. This will tell to PHP to keep all the output in a buffer until the script execution ends, so you still can change the header.

    Usually I don't use output buffering, for simple projects I keep all the logic on the first part of my script, then I output all HTML.

提交回复
热议问题