PHP Output Control function

Source: Internet
Author: User

Ob_start

This function opens the output buffer. When the output buffer is activated, the script will not output content (except for the HTTP header), and the output will be stored in the internal buffer instead.

The contents of the internal buffer can be copied into a string variable using the Ob_get_contents () function. To output content stored in an internal buffer, you can use the Ob_end_flush () function. In addition, using the Ob_end_clean () function silently discards the contents of the buffer.


The output buffers are stackable, which means that when a ob_start () is active, you can call another Ob_start (). Just make sure that the correct number of Ob_end_flush () is correctly called. If multiple output callback functions are active, the output will be filtered sequentially through them in nested order.

Flush

Refreshes the PHP program's buffering and sends all output of the program to the user's browser Ob_flush

The contents of the output buffer, if you want to further process the contents of the buffer, you must call Ob_get_contents () before Ob_flush (), because the buffer content will be discarded after calling Ob_flush (), and the buffer will not be destroyed.

Ob_end_flush

Output buffer contents, and close the output buffer.

Ob_get_flush

Output buffer content, and close the output buffer, unlike Ob_end_flush (), this function also returns the buffer contents as a string.

Ob_clean

Empty (erase) the output buffer.

Ob_end_clean

Empties (erases) the output buffer and closes the output buffer.

Ob_get_clean

Gets the contents of the current buffer and deletes the current output ease.

Ob_get_contents

Gets the contents of the buffer

Ob_get_length

Gets the length of the buffer content

Ob_get_level

Gets the nesting level of the buffering mechanism

Ob_get_status

Get the status of all output buffers

PHP Output Control function

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.