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'(); "<br/>ob_con".
Code
(" ",1024);(=0;<5;++ "<br/>"(1
A number is output in one second.
If no