About using session

Source: Internet
Author: User
Tags modify
session| Error Please see detailed error program and output result
?
echo "Testing ... ";
Session_Start ();
?>

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 php.ini has a definition of session, by default, by using cookies
[Session]
Session.use_cookies = 1; Whether to use cookies

This means that cookies are stored in session and cookies must be set before the official HTM, that is, only within header, so this error occurs

We modify the program to
?
echo "Testing ... ";
Session_Start ();
?>
The same error, because Echo has already exported

We modify the program to
?
$i = 1;
Session_Start ();
?>
Running correctly indicates that there can be a calculation statement in front of the session_start, but no output statements

I tried to modify it.
session.use_cookies = 0; Whether to use cookies
But did not succeed, want to know the answer friend informed me, how to remove the cookie method session

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.