Ask a session very simple about the question, little brother where I might be trapped

Source: Internet
Author: User
Ask a simple question of the session, where I might have been trapped.
PHP uses the session value to determine whether the user is logged in, I often see this example:
is to have a form, enter a user name and password, and then verify on a PHP page, if the validation is successful (that is, if a user name and password are found to match from the database), generate the following sessoin
$_session[' username '] = ' csdn ';
$_session[' pwd '] = ' pwd ';


Then on the other page to determine whether $_session[' username ' is empty, if not empty, the description is logged in ...

Then my question comes: Does the $_session exist on the server? That many users logged in, $_session[' username ' is not to be reset many times, how the server correctly to the client to make a distinction???

I am dizzy, I feel very simple thing, the result I Leng want not to understand ... It must be my understanding of the wrong, please help me to point out.
Thank you.
------to solve the idea----------------------
$_session is generated by the Session_Start function
The content of $_session is session_start based on the value of the incoming cookie.
So there's no doubt in your case.

That is to say user A's $_session and User B's $_session Although all is $_session, but the content is not the same
------to solve the idea----------------------
Session will have a session_id from the client to identify different users, this session_id is unique, so landlord do not worry about confusion.
------to solve the idea----------------------
Each call is unique ... That is the session_id mentioned above, so every time the browser and the server to establish the call when the ID is unique, the server will determine who I am talking to.
  • Related Article

    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.