I'm making a PHP IRC Bot, and it works great.
What I want to do though, is to have a live debugging option, which means I need to see the commands sent from an operator to the bot live. The problem is, as long as the bot's running, no output is being sent, even if I echo
, pr开发者_运维技巧intf
, or var_dump
.
So my question is, how can I force PHP to send the current output buffer without waiting for the logic to finish (because theoretically, it won't finish ever :P)
EDIT:
flush()
or ob_flush()
doesn't seem to work, see this simple example: http://codepad.viper-7.com/ks7zEy
use flush();
You're looking for ob_flush
Just put this at the top of your page:
while( ob_get_level() > 0 ) {
@ob_end_flush();
}
@ob_implicit_flush();
精彩评论