Ob_start describes this in the manual: This function will enable the output buffer. When the output buffer is activated, the script does not output content (except the http header). On the contrary, the content to be output is stored in the internal buffer. According to my understanding, {code...} and the manual... ob_start are described as follows:
This function enables the output buffer. When the output buffer is activated, the script does not output content (except the http header). On the contrary, the content to be output is stored in the internal buffer.
According to my understanding, this is the case:
Why is it different from what is described in the manual.
Reply content:Ob_start is described in the manual as follows:
This function enables the output buffer. When the output buffer is activated, the script does not output content (except the http header). On the contrary, the content to be output is stored in the internal buffer.
According to my understanding, this is the case:
Why is it different from what is described in the manual.
It should be understood that it will not be immediately output to the upper-level buffer. you can use the relevant operations of ob _ * to obtain, rush out, and clear the buffer. at this time, the output can be unified, such as regular processing, data packaging.
For static pages, you can use the ob cache technology provided by php to manually process cache content submitted by apche and other servers.
$ 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 your script has been executed.
The buffer is output.
You can add ob_end_clean () next to echo ();
The buffer will be cleared.
That's strange if you don't want to output it... Ob only allows us to get the rendering result of php and use it for caching.