最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php 中缓冲输出实例代码
时间:2022-06-24 18:24:23 编辑:袖梨 来源:一聚教程网
ob_start([string output_callback])- 打开输出缓冲区
所有的输出信息不在直接发送到浏览器,而是保存在输出缓冲区里面,可选得回调函数用于处理输出结果信息。
ob_end_flush - 结束(发送)输出缓冲区的内容,关闭输出缓冲区
*/
ob_start(); //打开缓冲区
echo "hello world"; //输出内容
$out=ob_get_clean(); //获得缓冲区内容并且结束缓冲区
$out=strtolower($out); //将字符转换为小写
var_dump($out); //输出结果
//
if(!function_exists('ob_clean')) //判断函数是否被定义
{
function ob_clean() //定义函数
{
if(@ob_end_clean())
{
return ob_start();
}
trigger_error("ob_clean() failed to delete buffer.no buffer to delete.",e_user_notice);
return false;
}
}
//
header('content-type: multipart/x-mixed-replace;boundary=endofsection'); //发送标头
print "n--endofsectionn"; //输出内容
$pmt=array("-","","|","/"); //定义数组
for($i=0;$i<10;$i++) //通过循环进行操作
{
sleep(1); //暂停执行
print "content-type: text/plainnn"; //输出内容
print "part $it".$pmt[$i % 4]; //输出内容
print "--endofsectionn"; //输出内容
ob_flush(); //发送缓冲区数据
flush(); //刷新输出缓冲
}
print "content-type: text/plainnn"; //输出内容
print "the endn"; //输出内容
print "--endofsection--n"; //输出内容
相关文章
- 大话西游云游戏极速入口-大话西游云端畅玩免下载在线直达 01-30
- 美赛官网登录入口-美国大学生数模竞赛官方访问 01-30
- 数学建模美赛时间查询-美国大学生数学竞赛官网入口 01-30
- fifa18网页版直达-fifa18试玩中文版一键入口 01-30
- 君有疾否txt下载百度网盘-君有疾否txt小说免费阅读地址 01-30
- 创游世界网页版直达入口-创游世界网页版即点即玩 01-30