Ob_start ([string output_callback])-open the output buffer
All output information is not directly sent to the browser, but saved in the output buffer. An optional callback function is used to process output result information.
Ob_end_flush-end (send) output buffer content, disable the output buffer
*/
Ob_start (); // open the buffer
Echo "hello world"; // output content
$ Out = ob_get_clean (); // obtain the buffer content and end the buffer.
$ Out = strtolower ($ out); // converts a character to lowercase.
Var_dump ($ out); // output result
//
If (! Function_exists ('ob _ clean') // checks whether the function is defined.
{
Function ob_clean () // define a function
{
If (@ ob_end_clean ())
{
Return ob_start ();
}
Trigger_error ("ob_clean () failed to delete buffer. no buffer to delete.", e_user_notice );
Return false;
}
}
//
Header ('content-type: multipart/x-mixed-replace; boundary = endofsection '); // send the header
Print "n -- endofsectionn"; // output content
$ Pmt = array ("-", "", "|", "/"); // defines an array
For ($ I = 0; $ I <10; $ I ++) // perform operations through Loops
{
Sleep (1); // pause execution
Print "content-type: text/plainnn"; // output content
Print "part $ it". $ pmt [$ I % 4]; // output content
Print "-- endofsectionn"; // output content
Ob_flush (); // sends the buffer data
Flush (); // refresh the output buffer
}
Print "content-type: text/plainnn"; // output content
Print "the endn"; // output content
Print "-- endofsection -- n"; // output content