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>
PHP输出缓冲控制
本文介绍PHP中的ob_start函数,该函数用于开启输出缓冲。通过一个示例演示如何使用用户自定义回调函数来替换输出内容中的特定字符串。
266

被折叠的 条评论
为什么被折叠?



