php ob_start()缓存技术

作者:袖梨 2022-07-02

YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.***w3.org/TR/REC-html40/loose.dtd">

ob_start()是开启output buffering,也就是缓冲输入内容
ob_gzhandle使用gzip处理内容,作为ob_start的参数,表示当输入缓冲内容时使用的回调函数,你也可以自己定义回调函数
例如手册中的例子:
[]

function callback($buffer)
{
// replace all the apples with oranges
return (str_replace("apples", "oranges", $buffer));
}

ob_start("callback");

?>



It's like comparing apples to oranges.




ob_end_flush();

?>
[/php]

输出时,内容中的apples会变成oranges,你可以试试去掉ob_start中的callback,看看有什么不同

相关文章

精彩推荐