session and cookie difference, multi-WEB server how to share session, after disabling COOKIE SESSION is available, and why?

A: The operating mechanism of the session:

A user visits the site Y, Y If the site specified session_start (); (the following assumptions session_start () always present) then produces a session_id, session_id this usually saved to the user in the form of A COOKIE (we can in php. ini in session.use_only_cookies set to 1 to force SESSIONID must COOKIE mail.). SESSIONID this time showed $ _COOKIE [ 'PHPSESSID']; (PHPSESSID available session_name () function to modify the next)

A user is then accessed, the session id ($ _ COOKID [ 'PHPSESSID']) will be sent to the site at the time of each visit A ​​Y. Y is

On site Y, there will be such a directory is used to store the actual data SESSION. SessionID receiving station Y, and then through the session id, to obtain data associated with the SESSION, SESSION and return data.

A: The difference between session and cookie:

SESSION stored on the server side, the user can not be modified, relatively safe, the client, the user can be modified by means COOKIE storage, relatively insecure.

Session will be held in a certain time on the server when accessing the increase, it would be more tying up server resources.

Single cookie in the client's limit is 3k, a site that is stored in the COOKIE client can not exceed 3k.

A: How many servers share SESSION:

Each server is a shared public, it is clearly a special session to put this into a place
such as memory databases, each database server are transferred in the session
principle kept the same memcache

A: Yes, but needs to pass when the value of the Session_id writes the URL; the time because after disabling and then pass parameters will be in the form of parameters passed to the URL of the past behind!

Transfer from https://www.cnblogs.com/dai-idiot/p/4630890.html

Guess you like

Origin www.cnblogs.com/jokmangood/p/11705931.html