In general, the following points are missing from the session:
1, the client has disabled cookies
2, the browser can not access cookies
3, session.use_trans_sid=0 or compile-time in php.ini
The –ENABLE-TRANS-SID option is not turned on
The session is stored on the server side (stored by default as a file) and comes to the user's file based on the session ID provided by the client.
Gets the value of the variable, the session ID can use the client's cookie or the Http1.1 protocol's query_string
(Is the URL of the access "?" Later) to the server, and then the server reads the directory of the session .... Other words
The session ID is the identity card that gets the session variable stored on the service. When the code is session_start ();
A session file is generated on the server, and it is followed by the only one that corresponds to it.
Define the session variable to be stored in a certain form in the session file that you just generated. With the session ID,
You can take out the defined variables. After the page spread, in order to use session, you have to perform session_start ();
A session file will be generated, corresponding to the corresponding sessions ID,
This session ID cannot be used to get the variables in the first session file mentioned earlier.
Because this session ID is not the "key" to open it. If in session_start ();
Code session_id ($session ID) before, and no new session file will be generated.
Read directly the session file corresponding to this ID.
The session in PHP uses the client's cookie to save the session ID by default,
Therefore, when the client's cookie problems will affect the session. It is important to note that:
The session does not have to rely on cookies, which is a clever place to compare cookies to.
When a client's cookie is disabled or a problem occurs, PHP automatically attaches the session ID to the URL.
This allows the session variable to be used across pages through the session ID. But this attachment also has certain conditions,
That is, "Session.use_trans_sid = 1 in php.ini or open –enable-trans-sid option at compile time."
Understand the above reasons, now we have to put aside cookies use session, the main way there are three:
1, set the SESSION.USE_TRANS_SID = 1 in php.ini or open the –ENABLE-TRANS-SID option at compile time,
Let PHP automatically pass the session ID across pages.
2, manually through the URL to pass the value, hide the form pass session ID.
3, in the form of files, databases and other forms of saving session_id, in the spread of the process of manual call.