flush during runtime:
I've got a php scr开发者_JS百科ipt running constantly, during which I'm looking at a webpage with the logs. Is there any way to automatically scroll to the last entry when flushing?
My flush function (only way I could make it work):
function flush2 (){
echo(str_repeat(' ',256));
if (ob_get_length()){
@ob_flush();
@flush();
@ob_end_flush();
}
@ob_start();
}
If with "scroll" you mean "scroll the browser viewport", this is client-side stuff.
I strongly suggest you to use AJAX to periodically poll a PHP script that returns the "new" stuff (I don't know what it is looking at the example), and everytime it gets some new entry, it creates a new DOM element at the bottom of the page, and scrolls the page down.
精彩评论