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.