Portál AbcLinuxu, 6. května 2025 06:08
Řešení dotazu:
<?php ignore_user_abort(false); while (true) { // chvíľu niečo počítaj echo "."; flush(); }
flush()
, ale pred nim jeste ob_flush()
. Tedy pokud ma vystup putovat pres Apache do weboveho prohlizece
Neptejte se me proc
Priklad:
ini_set('display_errors', 1); error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); $ip = '8.8.8.8'; $cmd = "/bin/ping -c10 -W2 -n $ip 2>&1"; $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"), ); ob_flush(); flush(); $process = proc_open($cmd, $descriptorspec, $pipes, realpath('./'), array()); if (is_resource($process)) { while ($s = fgets($pipes[1])) { print $s; ob_flush(); flush(); } }
Neptejte se me proc
asi proto hele :O :O
flush() may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser. It also doesn't affect PHP's userspace output buffering mechanism. This means you will have to call both ob_flush() and flush() to flush the ob output buffers if you are using those.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.