ob_start()函数的使用说明

来源:互联网 发布:mac os yosemite 升级 编辑:程序博客网 时间:2024/05/26 22:05

ob_start — Turn on output buffering

说明

bool ob_start ( [callback $output_callback [, int $chunk_size [, bool $erase]]] )

返回值

如果成功则返回 TRUE,失败则返回 FALSE

更新日志

范例

例 1633. User defined callback function example

<?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
();

?>

上例将输出:

<html><body><p>It's like comparing oranges to oranges.</p></body></html>

 

原创粉丝点击