PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm having a problem redirecting between my pages. I have a page which I want to continue to execute after i've redirected the user.
I've simulated that page doing work with the sleep command. The redirect only occurs after the sleep has completed.
Simply setting a redirect header doesn't stop the script executing. It will continue through to its conclusion unless you exit() to terminate the script after sending the redirect header
Mark Baker wrote:Simply setting a redirect header doesn't stop the script executing. It will continue through to its conclusion unless you exit() to terminate the script after sending the redirect header
I know that, and that's exactly the behaviour that I want to make use of.
What i'm saying is why does it take 60 seconds for the header() to be sent? even after a flush?
I need a way of forwarding the user while the execution continues behind.
In that case, you really need to spawn off a separate process to handle the "background" function independently of the called script, then terminate the called script to force the headers to do the redirect