Does die() do an ob_end_flush()?
I can't seem to 开发者_如何转开发find a good answer on this anywhere. If I am running output buffering, and a die()
is fired, does that kick off an ob_end_flush()
as well?
Yes it does. Any time the script ends gracefully, the buffers will be emptied. The only non-graceful endings are if it segmentation faults or if it's killed (signal 9 SIG_KILL). The only place that die()
does a hard-kill of the process is if you call it inside of a register_shutdown_function
(But the buffers are flushed before the shutdown function is called, so there's no issue there). See Connection Handling for some more information...
Yes.
However, you can make the output empty if you have
register_shutdown_function('ob_clean');
earlier in the code.
In some cases we did not want to output the ob on a die(). I write this here in case it could help anyone who wants to do the same.
精彩评论