You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it intentional that the script won't immediately exit after a redirect()? In fact, it won't even break out of the callback unless I return right after. Seems a little counter-intuitive to me, but might be I'm missing something.
The text was updated successfully, but these errors were encountered:
Yes. A redirect() call is simply a way to easily set the Response's code and "Location" header. This is much like Ruby's "Rack" middleware, and most other implementations of low-level HTTP handling in frameworks.
The redirect() method also conveniently locks the Response, though, so no further modifications will easily be made to it without explicitly unlocking it first.
If you'd like a more immediate effect, then you could run send() right after to write the headers right then. However, the code following those statements will still run.
It may seem counter-intuitive if you think of the redirect() method as a "browser command" or some other black magic, but all its really doing is sending a header, which PHP has to send to the browser/HTTP client.
Is it intentional that the script won't immediately exit after a
redirect()
? In fact, it won't even break out of the callback unless Ireturn
right after. Seems a little counter-intuitive to me, but might be I'm missing something.The text was updated successfully, but these errors were encountered: