Urgent request: About PHP Real-time output data to the client.
The test code is as follows:
Ob_start ();
for ($i = 1; $i <=; $i + +) {
$sourceName = ' filetoupload '. $i;
$imageArray = Array ();
$message = "Image $i have been uploaded to the server";
Echo $message;
Flush ();
Ob_flush ();
Usleep (500000);
}
Ob_end_flush ();
?>
The test results are as follows:
On the local server, the script can run side output, but in the intranet server running is 100 cycles after the run-time output;
Desired correct result:
As the results are running on the local server, the side runs the output display. Why the same script in the network server execution is a different result, is not related to which configuration item in PHP.ini??? What configuration items are associated with??? Hope to get everyone's help, thank you first.
------Solution--------------------
If you're really in a hurry! I think of a way! is the page transfer value, do not use the loop!
PHP Code
$id =empty ($_get[' id '))? 1:intval ($_get[' id '); $sourceName = ' filetoupload '. $i; $imageArray = Array (); $message = "Image $i has been uploaded to the server"; Echo $message; if ($id >=100) {exit ();} $id + +; $msg. = "
"; Echo $msg; exit ();
------Solution--------------------
I've been working on this for a long time. Linux final discovery is a cache problem
PHP Code
------Solution--------------------
discuss
Reference:
I've been working on this for a long time. Linux final discovery is a cache problem
PHP Code
Ob_start ();
for ($i = 1; $i <=; $i + +) {
Ob_end_flush ();//Close cache
$sourceName = ' filetoupload '. $i;
$imageArray = arr ...
------Solution--------------------
This buffer is related to the browser, and some of the Apache modules are also relevant.
Keep try
===================================
PHP code
ob_end_clean (); Apache_setenv (' No-gzip ', 1); Ini_set (' Zlib.output_compression ', 0); Ini_set (' Implicit_flush ', 1), Ob_start ();//start buffer data for ($i = 1; $i <=, $i + +) {$source Name = ' filetoupload '. $i; $imageArray = Array (); $message = "Image $i have been uploaded to the server
"; echo $message. Str_repeat ("", 1024x768);//ie has the default 1k buffer Ob_flush (); Flush (); Usleep (500000);}