You know that if you want to redirect an user in PHP you can use the header function:
header(\'Location: http://smowhere.com\');
It is also
header()
instructs PHP that a HTTP header should be sent... When the HTTP headers are sent.
And those are not sent immediatly when you write the call to header(), but when it's time to send them (typically, when PHP needs to begin sending the body of the response -- which might be later than you think, when output_buffering
is enabed).
So, if you just call header()
, there is absolutly ne guarantee that the code written after this statement is not executed -- unless you indicate that it must not, by using exit
/die
.
The user can ignore the Location
header if he wants ; but it will not change anything on the fact that the code after the call of header()
might or might not be executed : that matter is server-side.