Several examples of PHP buffering techniques _php Tutorials

Source: Internet
Author: User
Initialize session
Session_Start ();
Add a value for URL rewrite
Output_add_rewrite_var (' var ', ' value ');
Insert a connection
echo ' link ';
Send buffer data
Ob_flush ();
Reset the value of the URL rewrite
Output_reset_rewrite_vars ();
Insert a connection
echo ' link ';

/*

*/

Print_r (Ob_list_handlers ());//lists the output handles used, and outputs the default output handler
Ob_end_flush (); Send buffer data and close buffer
Ob_start ("Ob_gzhandler"); Open the buffer and use the Ob_gzhandler
Print_r (Ob_list_handlers ()); Lists the output handles and outputs the Ob_gzhandler
Ob_end_flush (); Send buffer data and close buffer
Ob_start (create_function (' $string ', ' return $string; ')); Open buffer
Print_r (Ob_list_handlers ()); Lists the output handles that are used, and outputs the default output handler
Ob_end_flush (); Send buffer data and close buffer

/*

*/

if (Ob_get_level () ==0)//Determine the buffer level, if there is no active buffer
Ob_start (); Open buffer
for ($i =0; $i <10; $i + +)//Loop execution
{
echo "
Line to show. "; Output content
Echo Str_pad (", 4096)." n "; Output-generated string
Ob_flush (); Send buffer data
Flush (); Flush buffers
Sleep (1); Pause for 1 seconds
}
echo "done."; Output Operation completion Tag
Ob_end_flush (); Send buffer data, and close buffer

?>

http://www.bkjia.com/PHPjc/631708.html www.bkjia.com true http://www.bkjia.com/PHPjc/631708.html techarticle //Initialize session session_start ();//Add URL rewrite value output_add_rewrite_var (' var ', ' value ');//Insert a connection echo ' a href= file.php tutorial link/a '; Send buffer data ...

  • 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.