How to redirect to another page using PHP

前端 未结 12 1406
粉色の甜心
粉色の甜心 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:35

    That's the problem. I've outputted a bunch of information (including the HTML to build the login page itself). So how do I redirect the user from one page to the next?

    This means your application design is pretty broken. You shouldn't be doing output while your business logic is running. Go an use a template engine (like Smarty) or quickfix it by using output buffering).

    Another option (not a good one though!) would be outputting JavaScript to redirect:

    
    

提交回复
热议问题