PHP Learning Notes-session control simply introduces session and Cookie

Source: Internet
Author: User
Tags set cookie

Session_stater ();
Session control
The HTTP protocol is based on the TCP protocol
HTTP Protocol called Stateless Protocol
Features of the session:

1 stored on the server;

2 Each user will generate a session;

3 There is a default expiration time of about 15 minutes;

4session can store any type of data;

Characteristics of Cookies:

1 stored on the client;

2 Each user will generate a cookie;

3 default does not expire time, but you can set the expiration time yourself;

4 only strings can be stored
SESSION: Security But too high a server requirement;
Cookies: Flexible and insecure
Use of Session
1, the page using session must be opened in the first line of code sesssion
$_session["UID"]= "Zhang San";//Assignment
echo $_session["UID"];
Use of cookies
Setcookie ("UID", "List");//Assignment (Set cookie)

PHP Learning Notes-session control simply introduces session and Cookie

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.