Phpoutputbuffering cache and program cache. If the following test is performed before the test to make the test more effective, we will output the following code in Output_bufferingoffDisplay_errorson php (content-type: texthtml; charsetutf-8ok;
In
If
Test
Before the test, to make the test more effective, we
Output_buffering = off
Display_errors = on
Code
"php" ("content-type:text/html;charset='utf-8'" 'ok';
The
Php
Warning: Cannot modify header information-headers already sent by (output started at D: \ www \ apache \ htdocs \ test \ t2.php: 2) in D: \ www \ apache \ htdocs \ test \ t2.php on line 3
OK
Code 2:
"php" ("content-type:text/html;charset='utf-8'" 'ok';
The results are completely correct.
Cause analysis:
The code Phpecho 'php' already sends a header to the browser,
When
Header ("content-type: text/html; charset = 'utf-8 '");
The header information is displayed again, and the above header information has been recalled. this error cannot be solved.
Put the data to be sent to the browser in the 'php' code first
Let's look at the following code for better understanding:
Code
"php"("content-type:text/html;charset='utf-8'" 'ok' '
'= ;
Output
Ob_get_contents ()
Ob_get_contents ()
Code
"php" (); ("content-type:text/html;charset='utf-8'" 'ok' '
' = ;
Result:
Code
"php"();("content-type:text/html;charset='utf-8'" 'ok' '
'= ;
Result:
Code
"php"();("content-type:text/html;charset='utf-8'" 'ok' '
'= ;
Code
"php"();("content-type:text/html;charset='utf-8'" 'ok' '
'= ;
Result:
Ob_clean ()
Clear
Ob_get_flush ()
Clears the cache to the program cache and closes it.
Code
'abc'("content-type:text/html;charset='utf-8'" 'hello' 'aa'
2. ob_flush (), flush ()
Code
'a'();
Code
'a'(); "
ob_con".
Code
(" ",1024);(=0;<5;++ "
"(1
A number is output in one second.
If no
Else if the following test is performed before the test to make the test more effective, we will go to Output_buffering = off Display_errors = on code "php" ("content-type: text/html; charset = 'utf-8' "'OK'; then...