使用ob_start()把輸出那同輸出到緩沖區,而不是到瀏覽器。然后用ob_get_contents得到緩沖區的數據。ob_start()在服務器打開一個緩沖區來保存所有的輸出。所以在任何時候 " /> 无码日韩人妻精品久久蜜桃免费,中文字幕天堂久久精品,青春禁区动漫免费观看

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

關于ob_get_contents(),ob_end_clean(),ob_start(),的具體用法詳解

ob_get_contents();
ob_end_clean();
ob_start()

使用ob_start()把輸出那同輸出到緩沖區,而不是到瀏覽器。
然后用ob_get_contents得到緩沖區的數據。
ob_start()在服務器打開一個緩沖區來保存所有的輸出。所以在任何時候使用echo ,輸出都將被加入緩沖區中,直到程序運行結束或者使用ob_flush()來結束。然后在服務器中緩沖區的內容才會發送到瀏覽器,由瀏覽器來解析顯示。

函數ob_end_clean 會清除緩沖區的內容,并將緩沖區關閉,但不會輸出內容。
此時得用一個函數ob_get_contents()在ob_end_clean()前面來獲得緩沖區的內容。
這樣的話,能將在執行ob_end_clean()前把內容保存到一個變量中,然后在ob_end_clean()后面對這個變量做操作。

這是EG:
ob_start(); // buf1
echo ' multiple ';
ob_start(); // buf2
echo ' buffers work ';
$buf2 = ob_get_contents();
ob_end_clean();
$buf1 = ob_get_contents();
ob_end_clean();
echo $buf1;
echo '<br/>';
echo $buf2;
ob_get_contents

(php 4, php 5)
ob_get_contents -- Return the contents of the output buffer
Description
string ob_get_contents ( void )
This will return the contents of the output buffer or FALSE, if output buffering isn't active.
See also ob_start() and ob_get_length().
if you use ob_start with a callback function as a parameter, and that function changes ob string (as in example in manual) don't expect that ob_get_contents will return changed ob.
it will work as you would use ob_start with no parameter at all. So don't be confused.
transfer image, another method (alternative to fsockopen or function socket) :
server(192.168.0.1)
makeimage.php
...........
...........
$nameimage="xxxx.jpg"
$comand=exec("plotvelocity.sh $nameimage $paramater1 $paramater2");
ob_start();
readfile($nameimage);
$image_data = ob_get_contents();
ob_end_clean();
echo $image_data;
unlink($nameimage);
Client (192.168.0.2)
$bild="images/newimage2.gif";
$host="192.168.0.1";
$url=file_get_contents("http://$host/makeimage.php?$querystring");
$fp = fopen("$bild", 'wb');
fwrite($fp, $url);
fclose($fp);
echo '<img src="'.$bild.'">';
naturally you can transfer whichever thing and not only images
ob_get_clean

(php 4 >= 4.3.0, php 5)
ob_get_clean -- Get current buffer contents and delete current output buffer
Description
string ob_get_clean ( void )
This will return the contents of the output buffer and end output buffering. If output buffering isn't active then FALSE is returned. ob_get_clean() essentially executes both ob_get_contents() and ob_end_clean().

例子 1. A simple ob_get_clean() example
復制代碼 代碼如下:
<?php
ob_start();
echo "Hello World";
$out = ob_get_clean();
$out = strtolower($out);
var_dump($out);
?>

Our example will output: string(11) "hello world"
See also ob_start() and ob_get_contents().
Notice that the function beneath does not catch errors, so throw in an @ before those ob_* calls
Running php4 < 4.3.0, you can simply add the following to use the function anyway:
復制代碼 代碼如下:
<?php
if (!function_exists("ob_get_clean")) {
function ob_get_clean() {
$ob_contents = ob_get_contents();
ob_end_clean();
return $ob_contents;
}
}
?>

php技術關于ob_get_contents(),ob_end_clean(),ob_start(),的具體用法詳解,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 99国产在线视频有精品视频 | 亚洲伊人情人综合网站 | 7723日本高清完整版在线观看 | 日本色高清 | 国产精品视频第一区二区三区 | 久久精品亚洲国产AV涩情 | 无码人妻精品一区二区蜜桃色 | 洗濯屋H纯肉动漫在线观看 羲义嫁密着中出交尾gvg794 | 嫩草影院在线观看精品 | 日韩1区1区产品乱码芒果榴莲 | 蜜柚影院在线观看免费高清中文 | 亚洲欧美综合中文字幕 | 美女被日出水 | 日日干日日操日日射 | 国产一区私人高清影院 | 午夜国产精品视频 | 久久亚洲国产中文字幕 | 亚洲AV色香蕉一区二区9255 | 亚洲 日韩 国产 制服 在线 | 69久久国产露脸精品国产 | 考试考90就可以晚上和老师C | 99久久久无码国产精品免费人妻 | 四虎国产精品永久免费入口 | 爱暖暖1000部免费 | 亚洲大码熟女在线 | 爱啪国产精品视频在线 | 在线免费观看亚洲视频 | 亚洲精品国产自在现线最新 | 精品国产乱码久久久久久软件 | 国产精品久久大陆 | 中文字幕亚洲第一 | 18禁黄无遮挡禁游戏在线下载 | 国产在线观看成人免费视频 | 乱h好大噗嗤噗嗤烂了 | 亚洲成色爱我久久 | 国产精品人成视频免费999 | 捏揉舔水插按摩师 | FREE性丰满白嫩白嫩的HD | 成人精品视频在线观看 | 无码日本亚洲一区久久精品 | YELLOW高清视频免费观看 |