The flush () function is invalid? The output cannot be refreshed in real time. how can this problem be solved?

Source: Internet
Author: User
The flush () function is invalid? The output cannot be refreshed in real time. how can this problem be solved? This post was last edited by zhoumengkang at 13:46:14

The test code is as follows:
 abc___'.$i;ob_flush();flush();sleep(1);}ob_end_flush();?> 

In theory, it should be one second, right? However, the test result is only 5 seconds later.
I checked on the Internet the following example: "Some web server programs, especially the web server programs under Win32, will still cache the script output before sending the results to the browser, until the program ends. "I am a 64-bit windows local xampp integrated environment.


Reply to discussion (solution)

This method of occupying user bandwidth without reason is boring.
The effect of delayed output should be implemented using js in the browser

Your code will never see the expected results in IE, because IE needs to wait until the buffer is full to explain the received data.

This method of occupying user bandwidth without reason is boring.
The effect of delayed output should be implemented using js in the browser

Your code will never see the expected results in IE, because IE needs to wait until the buffer is full to explain the received data.
Yes, No. I don't know much about this function. I am using chrome for testing.
In fact, I want to achieve this: for example, I write a script to batch process some files.
But that process may be very long. if it is used by others, no one else knows whether it is being executed or stuck.
Therefore, if the execution of each loop is successful, an xxxx statement is output successfully;
-------------
The most similar is the display of data tables created when we install open source software.
However, what I write is displayed only after all the data tables are created.

This method of occupying user bandwidth without reason is boring.
The effect of delayed output should be implemented using js in the browser

Your code will never see the expected results in IE, because IE needs to wait until the buffer is full to explain the received data.
My idea is not "latency", but "instant" display of my completed operations. I don't know what tips the moderator has.

Same question! I also have a program that runs for several hours. I can only check the data in the database to check whether the program runs normally.
My current practice is only for simple monitoring. For example, add a memcache write operation to the program and write a page to read the data.

Same question! I also have a program that runs for several hours. I can only check the data in the database to check whether the program runs normally.
My current practice is only for simple monitoring. For example, add a memcache write operation to the program and write a page to read the data. There is a good way to do it. remember to share with me how other open-source code achieves the real-time display effect during installation.

I'm back. try again.

 ';ob_flush();flush(); sleep(1);}?>

These two days, this problem is quite a lot.
This method can be tested in various browsers, but some children's shoes said that this method can be used to write garbage into the cache area. you can try PHP to throw an exception and try again when you are free to study it.

I'm back. try again.

 ';ob_flush();flush(); sleep(1);}?>

These two days, this problem is quite a lot.
This method can be tested in various browsers, but some children's shoes said that this method can be used to write garbage into the cache area. you can try PHP to throw an exception and try again when you are free to study it.
I tried it and it was OK. Where is the secret?

I'm back. try again.

 ';ob_flush();flush(); sleep(1);}?>

These two days, this problem is quite a lot.
This method can be tested in various browsers, but some children's shoes said that this method can be used to write garbage into the cache area. you can try PHP to throw an exception and try again when you are free to study it.
Is it because of this? Echo str_pad (', 4096 );
The second setting time limit can be omitted. this program will certainly not run for more than 30 seconds.
Throw an exception. try-catch can also be used in this way. now, let me think about it! You are a good person!

Well, I started to consider using php_cli for this program. because of the many program steps, I thought it was unfriendly, but I still chose the page. However, the running time was too long and it became cumbersome to open the page, use cli. come on.

Well, I started to consider using php_cli for this program. because of the many program steps, I thought it was unfriendly, but I still chose the page. However, the running time was too long and it became cumbersome to open the page, use cli. come on. Today, I tried to use chrome for testing again, or wait until the computation is complete and output the data at one time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.