Ec (2); in PHP programming, we often encounter some functions that directly generate output, such as passthru (), readfile (), var_dump (), etc. however, sometimes we want to import the output of these functions to a file, or process the output of these functions as strings. now we need to use the OutputBuffer function. there are several main functions for processing the output buffer: ob_start (script ec (2); script 
In PHP programming, we often encounter some functions that directly generate output, such as passthru (), readfile (), and var_dump. however, sometimes we want to import the output of these functions to a file, or process the output of these functions as strings. 
Now we need to use the Output Buffer function. 
 
There are several main functions for processing the output buffer: 
 
Ob_start () starts to output the buffer, and PHP stops the output. After that, the output is forwarded to an internal buffer. 
 
The ob_get_contents () function returns the content of the internal buffer. This is equivalent to converting these outputs into strings. 
 
Ob_get _ length () returns the length of the internal buffer. 
 
Ob_end_flush () ends the output buffer and outputs the content in the buffer. After that, the output is normal. 
 
Ob_end_clean () ends the output buffer and discards the content in the buffer. 
 
For example, the var_dump () function outputs the structure and content of a variable, which is useful during debugging. 
However, if the variable content contains special HTML characters such as <,>, the output will be invisible to the webpage. What should I do? 
The output buffer function can easily solve this problem. 
 
Ob_start (); 
Var_dump ($ var ); 
$ Out = ob_get_contents (); 
Ob_end_clean (); 
 
 
At this time, the output of var_dump () already exists in $ out. You can output it now: 
 
Echo'' 
'' . htmlspecialchars($out) . ''
''; 
 
Or wait till the future, or send this string to the Template before outputting it. 
 
 
 
<