From: http://bbs.phome.net/ShowThread/?threadid=9247&forumid=2
In PHP programming, we often encounter some functions that produce output directly, such as PassThru (), ReadFile (), var_dump (), etc. But sometimes we want to import the output of these functions into a file, either by processing and then outputting, or by processing the output of these functions as strings.
Then we're going to use the output buffer function.
There are a number of functions that process output buffering:
Ob_start () starts the output buffer, when PHP stops the output, after which the output is transferred to an internal buffer.
Ob_get_contents () This function returns the contents of the internal buffer. This is tantamount to turning these outputs into strings.
Ob_get_ Length () returns the size of the internal buffer.
Ob_end_flush () ends the output buffer and outputs the contents of the buffer. The output after this is the normal output.
Ob_end_clean () ends the output buffer and discards the contents of the buffer.
For example, the Var_dump () function outputs the structure and content of a variable, which is useful when debugging.
But if the contents of the variable have <, > and other HTML special characters, output to the Web page can not be seen. What do we do?
The output buffering function can be used to solve this problem easily.
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.