See detailed error programs and output results
<Html>
<?
Echo "testing ...";
Session_start ();
?>
</Html>
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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.