简体   繁体   中英

PHP - Sending the current output buffer

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 , printf , 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

使用flush();

您在寻找ob_flush

Just put this at the top of your page:

while( ob_get_level() > 0 ) {
    @ob_end_flush();
}
@ob_implicit_flush();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM