Home > Backend Development > PHP Tutorial > Detailed explanation of the use of PHP cache area_PHP tutorial

Detailed explanation of the use of PHP cache area_PHP tutorial

WBOY
Release: 2016-07-13 17:42:43
Original
844 people have browsed it

for ($i=0; $i<10; $i ) {   
        ob_start();   
        echo "This is iteration $i: ";   
        // * Dont do this!   
        // $buf = ob_get_contents();   
        // ob_clean();   
        // * Use this instead:   
        $buf = ob_get_flush();   
        //缓冲区关闭,竟然还有内容   
        $test=ob_get_contents();   
        echo $test,---->;   
        echo $buf;   
        echo memory_get_usage()." ";   
        echo
;   
}   
?>   

for ($i=0; $i<10; $i ) {
        ob_start();
        echo "This is iteration $i: ";
        // * Dont do this!
        // $buf = ob_get_contents();
        // ob_clean();
        // * Use this instead:
        $buf = ob_get_flush();
        //缓冲区关闭,竟然还有内容
        $test=ob_get_contents();
        echo $test,---->;
        echo $buf;
        echo memory_get_usage()."";
        echo
;
}
?>

ob_get_flush相当于ob_end_flush,只有一点区别,ob_get_flush获取缓存区内容,保存到变量中,并关闭缓存区。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486045.htmlTechArticle?php for ($i=0; $i10; $i ) { ob_start(); echo "This is iteration $i: "; // * Dont do this! // $buf = ob_get_contents(); // ob_clean(); // * Use this instead: $buf = ob_get_flush();...
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