Headers & amp; nbsp that appears when session_start is used. Please refer to the detailed error program and output result html? Echotesting...; session_start ();? The html output is testing... Warning: Cannotsendsessioncookie-headersalreadysentby (please refer to the detailed error program and output result
Echo "testing ...";
Session_start ();
?>
The output is
Testing...
Warning: Cannot send session cookie-headers already sent by (output started at F: php2000test. php: 2) in F: php2000test. php on line 4
Warning: Cannot send session cache limiter-headers already sent (output started at F: php2000test. php: 2) in F: php2000test. php on line 4
Analysis:
The main reason is that session is defined in php. ini. cookie is used by default.
[Session]
Session. use_cookies = 1; whether to use cookies
This statement indicates that the use of cookies to store sessions and the setting of cookies must be performed before the official htm, that is, only in the header. Therefore, this error occurs.
We modify the program
Echo "testing ...";
Session_start ();
?>
The same error occurs because echo has output
We modify the program
$ I = 1;
Session_start ();
?>
Running properly indicates that there can be a computing statement before session_start, but no output statement.
I tried to modify
Session. use_cookies = 0; whether to use cookies
But it failed. a friend who wants to know the answer will inform me how to remove the cookie-based session.
Html? Echo "testing..."; session_start ();? /The html output is testing... Warning: Cannot send session cookie-headers already sent (...