PHP session_start()

后端 未结 5 1686
眼角桃花
眼角桃花 2020-11-29 03:42

What is this really?

Does it start a current session based on cookies? Got that from the PHP website. How does PHP control the session? If I start a session when a

5条回答
  •  生来不讨喜
    2020-11-29 04:12

    You can compare PHP session with the cookie, but session is the much more secure way of storing information. Cookie store data on user's computer, but session store on the server in a temporary file securely. I have discussed session and how to use it on one of my blog post - How to start a PHP session, store and accessing Session data?

    Below is an example code of storing data in PHP session:

    
    

    Below is the example of retriving the session data:

    
    

    The above code will display the name "John".

    Source: How to start a PHP session, store and accessing Session data?

提交回复
热议问题