PHP source code

Source: Internet
Author: User
Ec (2); PHP program buffer, regardless of the circumstances in which PHP is executed (CGI, web server, etc ). This function sends all the output of the program so far to the user's browser. The flush () function does not affect the cache mode of the server or client browser. Therefore, you must use both the ob_flush () and flush () functions to refresh the output buffer. Some web server programs, especially the web server programs under Win32, will still cache the script ec (2) before sending the results to the browser;

The buffer of the PHP program, regardless of the circumstances in which PHP is executed (CGI, web server, etc ). This function sends all the output of the program so far to the user's browser.
The flush () function does not affect the cache mode of the server or client browser. Therefore, you must use both the ob_flush () and flush () functions to refresh the output buffer.
Some web server programs, especially the web server programs under Win32, will cache the Script output until the program ends before sending the results to the browser.

*/
For ($ I = 10; $ I> 0; $ I --)
{
Echo $ I;
Ob_flush ();
Flush ();
Sleep (1 );
}

// Microsoft Internet Explorer displays the page only after receiving the 256 bytes. Therefore, some extra spaces must be sent for these browsers to display the page content.

// Normal usage

Ob_start ();
Ob_end_flush ();
For ($ I = 1; $ I <= 300; $ I ++) echo 'www.111cn.net ';

$ I = 0;
While (1 ){
Echo $ I;
Sleep (1 );
$ I ++;
}

For ($ I = 0; $ I <10; $ I ++ ){
Echo $ I;
Flush ();
Sleep (1 );
}

// This code should output $ I every second, but not necessarily in reality. In IE, it may be that after 10 seconds, all the output will be displayed at the same time.

// Ob_end_flush (); // IE8 does not work
Echo str_pad ("", 256); // IE must receive 256 bytes before display starts

For ($ I = 0; $ I <18; $ I ++ ){
Echo $ I;
Flush ();
Sleep (1 );
}

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.