1.
Error tips
Warning:cannot send session Cookie-headers already sent
Warning:cannot Send session cache Limiter-headers already sent
Analysis and Solving methods
The reason for this kind of problem is that when you use Session_Start () in your program, you already have the actual HTML content output. Perhaps you say, I did not ah, I just echo or print a message. I'm sorry, the output from your Echo or print statement is the actual output of the HTML content. The solution to this type of problem is to transfer your session_start () to the first line of the program.
2.
Error tips
Warning:open (F:/689PHPSESSIONDATASESS_66A39376B873F4DAECF239891EDC98B5, O_RDWR) failed
Analysis and Solving methods
This error statement usually occurs because your php.ini about Session.save_path is not set up, and the solution is to set the Session.save_path and Session.cookie_path settings to
Session_save_path = C:temp
Session.cookie_path = C:temp
Then in the C: directory to create a temp directory, you can
3.
Error tips
Warning:trying to destroy uninitialized sessions in
Analysis and Solving methods
A class such as a hint, the general situation is that you directly adjust the Session_destroy () function caused. Many friends think that the Session_destroy () function can run independently, but it is not. The solution is to use Session_Start () to open the session before you tune the Session_destroy () function.
4. Question: How do I get the ID value of the current session?
The easiest way to do this is to:
Echo SID;
You're going to find out.
5. Question: My program does not have any output before calling the header function, Although I include a config.php file, but there is no output in the config.php file, why does the session still report the same error as question 1, because I used the session_start () before the header 's sake?
A: Maybe you did check your PHP program carefully and did not have any output before referencing header (), and there is no output in your include file! But do you use the cursor keys in the?> of this PHP code after the sentence to move the check? Then you will find that after?> this, there is a blank line or a few spaces, you delete these empty lines or spaces, then the problem is solved.
Note: This problem will be in PHP4.1.2, later version, not tested.
6. Q: Use session to do login home page, other pages how to use the session limit login ...
Answer: The easiest way to do this is
Session_Start ();
if (!session_registered (' login ') ││ $login!= true) {
echo "You did not log in";
Exit
}
7. Q: I registered the session variable with Session_register (), but when I use header or JavaScript redirection statements, on the page, I can't access the value of the variable that the session registers. How can i solve this problem?
The program fragment of the problem:
?
Session_Start ();
$ok = ' love for you ';
Session_register (' OK ');
Header ("location:next.php");
?>