The SESSION is not shared?

Source: Internet
Author: User
Tags php session
I know that each user has a seesionid, but why do I write: {code...} on the server ...} I can read abc in a different browser. why do I still use SESSION to store the login username ??? It is clear that each user has its own session_id, which should not be shared .... I know that each user has a seesion id, but why do I write on the server:

$_SESSION['user_name'] = 'abc';

I can read abc in a different browser. why do I still use SESSION to store the login username ???
It is clear that each user has its own session_id, which should not be shared.
I may have gotten around and don't laugh at me.

Reply content:

I know that each user has a seesion id, but why do I write on the server:

$_SESSION['user_name'] = 'abc';

I can read abc in a different browser. why do I still use SESSION to store the login username ???
It is clear that each user has its own session_id, which should not be shared.
I may have gotten around and don't laugh at me.

    $_SESSION['user_name'] = 'abc';

Is this an assignment process? It can be read wherever it is assigned.

What does browser change mean? (Switch IE to firefox), or is it possible to switch multiple windows (TAB) in the browser? Or close the browser and open it?

In the same request, the user name is saved for later programs to read. Instead of going to the database every time.

This should not happen.

After the value is assigned, read again .. It has nothing to do with the id, right?

Php session is not related to user status. it is a simple kv storage system,
Because the http protocol is stateless, to identify users, it depends on cookies in user requests,
This cookie field is phpsessionid (by default), which is passed through user requests,
Anyone who obtains the sessionid can obtain the session content.
Just like the safe, anyone can get the key password,
This key password is only for you, so by default, only you can get it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.