Today we'll write how to use JS to set cookies, read cookies, and delete cookies. This code comes from the Web and is accompanied by a common Web page that uses cookies for learning.
Set cookies
The code is as follows
Copy Code
php two functions urlencode urldecodeJS two functions decodeURI encodeURI 5.5 Previous versions are already obsolete escape unescapeA simple example is as follows:1, PHP set cookies, JS read cookiesSetcookie ("username", UrlEncode ("Chinese Test"));?
CookiesCookies, sometimes in their plural form, are the data (usually encrypted) stored on the user's local terminal by certain websites in order to identify the user and track the session. Definitions of RFC2109 and 2965 have been deprecated, and
Cookie Overview
In the previous section, you used an immutable framework to store shopping bar data, and the product display page was constantly changing, although it was not rigorous to achieve a global variable. For example, if you right-click
Review
Cookies are a way for servers or scripts to maintain information on client workstations under the HTTP protocol. A cookie is a small file saved by a Web server in a user's browser that can contain information about a user, such as an
When you visit a website, you will produce a very small text file on your hard disk, which can record your user ID, password, browsed pages, time of stay, and so on.
When you come to the site again, the site by reading cookies, learn about your
First file login_frm.php This is the login windowCode
Copy Code code as follows:
User:
The second file login.php This is the process login
Copy Code code as follows:
if ($_post[
The difference between session and Cookie
Object
Information size
Save time
Application Range
Save location
Session
Small, simple data
User activity time + a delay time (typically 20 minutes)
The HTTP protocol is a stateless protocol, which means that every request you make to the site is independent and therefore cannot be saved by itself. But this simplicity is one of the reasons it has spread widely in the early days of the
A recent function, but the deletion of cookies is always invalid, do not understand what the reason.
Use $.cookie ("name", ""); The result is a cookie that generates a new null value.
Use $.cookie ("name", null); The cookie is deleted again.
Last
Specifically, the cookie mechanism is a scheme for maintaining state on the client side, and the session mechanism uses the scheme of maintaining state at the server end.
At the same time, we also see that because the server-side retention scheme
Cookie technology is a very controversial technology, since its inception it has become a vast number of network users and web developersA point of contention. Some Internet users, even some senior web experts, are dissatisfied with its generation
A summary of Cookie|cookies
cookie is a way for servers or scripts to maintain information on client workstations under the HTTP protocol. A cookie is a small file saved by a Web server in a user's browser that can contain information about a
Basic Tutorials | Basics of ASP Basics
1. ASP is the abbreviation for active Server pages and is an interpreted scripting locale;
2. The operation of the ASP requires Windows operating system, the installation of PWS is required under 9x, and NT/200
Shopping site sometimes need to understand the user's recent needs, collection and push the user's view record has become most of this kind of site indispensable functions, the following is my own in the development of the project to write their own
This article discusses how to completely eliminate the Warning:cannot add header information-headers already sent in ... This is a puzzling mistake.
As long as you have written PHP code, I believe you have encountered this most of the time is not
Session management is an important part of web development, including sessions and cookie two technologies. This chapter describes the creation and use of cookies and sessions.
Cookies:
Cookies are often used to identify users. Cookies are small
The easiest way to do this is to customize a httpclient by getting cookies, and interested friends can understand this article HttpClient Analog Login (use JS to set cookies) code as follows: cookie.setpath ("/"); Cookiestore.addcookie (cookie)
Conceptual Reference Advanced Programming:1. What is a cookie?Cookies are information used for client storage sessions; format Key=value;The composition of the 2.cookieName: The name of a unique cookie that is not case-sensitive, and the name of the
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.