php, simple ob_start()« Wróć do listy pytań
refresh site during calculation, process on page
|
▲ ▼ |
function simple_ob_start() { ini_set("zlib.output_compression", 0); ini_set("implicit_flush", 1); if (ob_get_level() == 0) ob_start(); echo "Starting live process..."; for ($i = 1; $i<100; $i++) { echo "current step $i of 100"; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(2); } echo "Done."; ob_end_flush(); } |