This is what Ob_start in the Handbook:
This function opens the output buffer. When the output buffer is activated, the script will not output content (except for the HTTP header), and the output will be stored in the internal buffer instead.
So, as I understand it:
为什么和手册里描述的不一样。
Reply content:
This is what Ob_start in the Handbook:
This function opens the output buffer. When the output buffer is activated, the script will not output content (except for the HTTP header), and the output will be stored in the internal buffer instead.
So, as I understand it:
为什么和手册里描述的不一样。
Should be understood as, not immediately output to the upper buffer, can be through the ob_* related operations to obtain, flush, clear, etc., at this time can be unified output, such as regular processing, data packaging.
Page statics can be processed manually by using the OB caching technology provided by PHP to Apche servers such as cache content submissions
$id = Isset ($_get[' id ')? $_get[' id ']-0:0; $filename = "html/". Date ("Ymd"). " /news-id ". $id.". HTML "; if (!file_exists (" html/". Date (" YMD ")) {mkdir (" html/". Date (" YMD "));} echo $filename; if (!file_exists ($filename) | | filemtime ($FILENAME) +60
Query ($sql); $row = $res->fetch_assoc (); if ($row) {echo '
"; echo "
"; echo "
Id | "; echo "
Title | "; echo "
Content | "; echo "
"; echo "
"; echo "
". $row [' id ']." | "; echo "
". $row [' title ']." | "; echo "
". $row [' content ']." | "; echo "
"; echo "
"; }else{echo "no data"; } $content = Ob_get_contents (); Ob_end_clean (); File_put_contents ($filename, $content);}
Require $filename;
That's because you ran out of scripts.
The buffer is lost.
You can add a Ob_end_clean () to the back of ECHO.
The buffers will be cleared away.
It's not the output that's weird ... OB just lets us get to PHP rendering results, do caching and so on.