Several commonly used php buffer technology examples

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags .url close data echo examples file link list

// Initialize the session
session_start ();
// Add url rewrite value
output_add_rewrite_var ('var', 'value');
// insert a connection
echo '<a href="file.php" navigator"> link </a>';
// send the buffer data
ob_flush ();
// Reset the value of url rewrite
output_reset_rewrite_vars ();
// insert a connection
echo '<a href="file.php"> link </a>'; / *

* /

print_r (ob_list_handlers ()); // List the output handles used and output the default output handler
ob_end_flush (); // send the buffer data and close the buffer
ob_start ("ob_gzhandler"); // Open the buffer and use ob_gzhandler
print_r (ob_list_handlers ()); // List the output handle, the output ob_gzhandler
ob_end_flush (); // send the buffer data and close the buffer
ob_start (create_function ('$ string', 'return $ string;')); // Open the buffer
print_r (ob_list_handlers ()); // List the output handles used and output the default output handler
ob_end_flush (); // send the buffer data and close the buffer / *

* /

if (ob_get_level () == 0) / / determine the buffer level, if there is no activity buffer
ob_start (); / / Open the buffer
for ($ i = 0; $ i <10; $ i ++) // Loop through the actions
{
echo "<br> line to show."; // output content
echo str_pad ('', 4096). "n"; // Output the generated string
ob_flush (); / / send buffer data
flush (); // refresh the buffer
sleep (1); // pause for 1 second
}
echo "done."; / / Output operation completed mark
ob_end_flush (); // send the buffer data, and close the buffer
?>

Related Article

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.