About IE's session loss problem: For the help of the great Gods of the road
The code is simple.
Session_Start ();
Header ("Content-type:text/html;charset=utf-8");
Setcookie (' username ', "AA", Time () +3600*24*365);
echo "PHPSESSID:". $_cookie[' Phpsessid ');
In the firefox,chrome can display the PHPSESSID normally, but in IE has written session, but cannot write to $_cookie[' PHPSESSID '], resulting in the subsequent tune not to the session content. Ask for answers
Environmental IE6
Share to: more
------Solution--------------------
Just refresh it, unless you close the cookie.
------Solution--------------------
Setcookie (' username ', "AA", Time () +3600*24*365, "/");
------Solution--------------------
See the landlord Session_Start immediately after Echo Phpsessid.
Setcookie Although the server will send cookie data to the browser, but the $_cookie array will not immediately get this corresponding key, including the first session_start after the cookie will not be immediately phpsessid, The creation of the cookie array is when the request occurs, the browser comes with a cookie to the server, the server is generated, not the Setcookie changes in real time
So the first time the Setcookie or Session_start,$_cookie array is empty, but the client has already had cookie data, and so on when the client refreshes and requests it, there will be the contents of the cookie array. But landlord refresh more than a few times will not see the error. I hope the landlord has a correct understanding of this aspect, or perhaps you already know.
==========================================
The point, according to my experience, to send a cookie to be compatible with IE browser, you must take the path parameter in the parameters of the Setcookie function