cookies and session contrast

cookies与session

- cookies: stored in the browser (client) user information

- session: the user information stored on the server

- After the user logs in successfully, the server generates a random character string (session value)

user_data.py
    user_online_data = {
        'addr': [session1, u_id]
    }

Role is to make the client's user login once, the next time access to the server without logging in, you can use some features

cookies: user information is stored in the client's browser

Advantages are: the data can be stored in one of the client

The disadvantage is: Unsafe

session: the server is stored in the user information

Advantages are: data security

The disadvantage is: session not unique, you can store multiple copies, causes the server to take up too much space

Guess you like

Origin www.cnblogs.com/godlover/p/12081959.html