Learning Essentials:
Application of 1.Cookie
2.Session Session Processing
HTTP (Hypertext Transfer Protocol) defines the transmission of text, graphics, video, and all data through the World Wide Web (WWW)
All the other data rules. HTTP is a stateless protocol that states that each request is processed in relation to the previous or subsequent
The request is irrelevant. While this simplified implementation has made a great contribution to the popularity of HTTP, it is a great choice to create complex
This is a bit disturbing for developers of WEB applications. To solve this problem, there is a
A small amount of information (cookie) is stored on the machine.
Due to the size limit, number of cookies and other reasons, the developer proposed a solution: session
The word processing.
A Application of Cookies
Set Cookie: Thesetcookie() function can generate a cookie file on the client, which can be saved to
Time, name, value, and so on.
Create a cookie
< span="">(' name ', ' Lee ',< span="">() + (7*24*60*60< span="">?>
Parameter 1:cookie name
Parameter 2:cookie value
Parameter 3:cookie Expiration time
Read cookies
< span="">< span="">[' Name '< span="">?>
Delete Cookies
< span="">(' name '< span="">< span="">, ' (' Name ', ' Lee '< span="">, ()-1 < span=""> ?>
Restrictions on the use of cookies
1, the HTML file must be set before the content output;
2. Different browsers have inconsistent handling of cookies and sometimes have incorrect results.
3, the limit is on the client. The maximum number of cookies a browser can create is 30, and each cannot
Over 4KB, the total number of cookies that can be set per Web site cannot exceed 20.
Two Session processing
When using session sessions, you must start the session and start with Session_Start ().
Create session and read session
< span="">< span="">< span="">[' name '] = ' Lee '< span="">< span="">< span="">[' name '< span="">?>
Determine if the session exists
< span="">< span="">< span="">[' name '] = ' Lee ' < span=""> < span=""> (< span="">< span="">[' Name< span="">'< span="">< span="">[' name '?>< span="">
Delete session
< span="">< span="">< span="">[' name '] = ' Lee '< span="">< span="">(< span="">[' name ' < span=""> < span=""> < span="">[' name '?> < span="">
Destroy All session
< span="">< span="">< span="">[' name '] = ' lee '< span="">< span="">[' name2 '] = ' lee ' < span=""> < span=""> < span=""> [' name ' < span=""> < span=""> < span=""> [' < span="">name2 '?> < span=""> < span="">
Note: The article is from Eon to PHP video tutorial, this article is limited to exchange use, not for commercial purposes, otherwise the consequences.
http://www.bkjia.com/PHPjc/759627.html www.bkjia.com true http://www.bkjia.com/PHPjc/759627.html techarticle Learning Essentials: 1.Cookie Application 2.Session Session processing HTTP (Hypertext Transfer Protocol) defines all of the text, graphics, video, and all other data transmitted over the World Wide Web (WWW) ...