Home > Backend Development > PHP Tutorial > Buffered output example code in php_PHP tutorial

Buffered output example code in php_PHP tutorial

WBOY
Release: 2016-07-20 11:09:10
Original
749 people have browsed it

ob_start ([string output_callback]) - Open the output buffer
All output information is no longer sent directly to the browser, but is saved in the output buffer. An optional callback function is used to process the output result information.
ob_end_flush - End (send) the contents of the output buffer, close the output buffer

*/

ob_start();      //Open the buffer
echo "hello world" ;                                            out); //Output result

//
if(!function_exists('ob_clean')) //Determine whether the function is defined

{

function ob_clean() / /Define 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 header

print "n--endofsectionn"; //Output content
$pmt=array("-","","|","/ ");                                            

                                                           print "content-type: text/plainnn"; //Output content
print "part $it".$pmt[$i % 4]; //Output content
print "--endofsectionn"; Output content
ob_flush(); //Send buffer data
flush(); //Refresh the output buffer
}
print "content-type: text/plainnn"; //Output content
print "the endn"; //Output content
print "--endofsection--n";



http://www.bkjia.com/PHPjc/444811.html

www.bkjia.com

true
http: //www.bkjia.com/PHPjc/444811.html

TechArticleob_start([string output_callback]) - Open the output buffer. All output information is not sent directly to the browser, but It is saved in the output buffer, and the optional callback function is used to process...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template