php ob_start()缓存技术
ob_start()是开启output buffering,也就是缓冲输入内容,ob_gzhandle使用gzip处理内容,作为ob_start的参数,表示当输入缓冲内容时使用的回调函数,你也可以自己定义回调函数.
例如手册中的例子:
<?php
function callback($buffer)
{
// replace all the apples with oranges
return (str_replace("apples", "oranges", $buffer));
}
ob_start("callback");
?>
<html>
<body>
<p>It's like comparing apples to oranges.</p>
</body>
</html>
<?php
ob_end_flush();
?>输出时,内容中的apples会变成oranges,你可以试试去掉ob_start中的callback,看看有什么不同.
本文地址:http://www.phprm.com/huihua/fs5777.html
转载随意,但请附上文章地址:-)