ob_end_flush();是个什么函数?

zairwolf 2003-10-21 11:16:59
中文手册上查不到?
...全文
1273 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fwolf 2003-10-21
  • 打赏
  • 举报
回复
和ob_start()配套使用
feel8 2003-10-21
  • 打赏
  • 举报
回复
ob_end_flush :发送内部缓冲区的内容到浏览器,并且关闭输出缓冲区。
使用方法:void ob_end_flush(void)
说明:这个函数发送输出缓冲区的内容(如果有的话)。
feel8 2003-10-21
  • 打赏
  • 举报
回复
ob_end_flush
(PHP 4 )

ob_end_flush -- Flush (send) the output buffer and turn off output buffering
Description
bool ob_end_flush ( void )


This function will send the contents of the topmost output buffer (if any) and turn this output buffer off. If you want to further process the buffer's contents you have to call ob_get_contents() before ob_end_flush() as the buffer contents are discarded after ob_end_flush() is called. The function returns TRUE when it successfully discarded one buffer and FALSE otherwise. Reasons for failure are first that you called the function without an active buffer or that for some reason a buffer could not be deleted (possible for special buffer).

The following example shows an easy way to flush and end all output buffers:

例子 1. ob_end_flush() example

<?php
while (@ob_end_flush());
?>




注: If the function fails it generates an E_NOTICE.

The boolean return value was added in PHP 4.2.0.

xuzuning 2003-10-21
  • 打赏
  • 举报
回复
PHP4 的新函数介绍 - 输出信息控制函数

发表于:中国PHP联盟 www.phpx.com 作者/来源:魔族精灵/腾讯 人气:3296

PHP4 的新函数介绍 - 输出信息控制函数
 魔族精灵


这些函数可以让你控制你的脚本输出的内容.可以用于许多不同的情况,特别是在你的脚本已经输出信息后需要发送文件头新的情况. 输出控制函数不对使用 header() 或 setcookie() 发送的文件头信息产生影响,只对那些类似于 echo() 和 PHP 代码的数据块有作用.

例 1. 控制输出

<?php

ob_start();
echo "Hello\n";

setcookie ("cookiename", "cookiedata");

ob_end_flush();

?>

在上面的例子中,使用 echo() 的输出内容将会保存在输出缓冲区中,直到调用了 ob_end_flush(). 这样做有意义的地方是,调用 setcookie() 的内容被成功的存储在 cookie 里面而不会引起错误. (正常情况下,你不可以在有数据已经发送后再发送文件头信息到用户浏览器.)

相关函数 header() and setcookie().

韩数列表
flush — 刷新输出缓冲区
保存在输出缓冲区的内容会被发送到浏览器

ob_start — 打开输出缓冲区
这样所有的输出信息不在直接发送到浏览器,而是保存在输出缓冲区里面

ob_get_contents — 返回输出缓冲区的内容
如果你想以后处理输出的内容,可以调用这个函数保留一个备份

ob_get_length — 返回输出缓冲区的内容长度

ob_end_flush — 结束(发送)输出缓冲区的内容,关闭输出缓冲区

ob_end_clean — 删除(放弃)输出缓冲区的内容,关闭输出缓冲区
如果你的程序发现输出内容有问题,可以放弃所有输出内容,可以防止泄漏某些秘密信息

ob_implicit_flush — 打开或关闭直接刷新
打开后,每个脚本输出都直接发送到浏览器,不再需要调用 flush(),

21,882

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧