码迷,mamicode.com
首页 > 其他好文 > 详细

cookie的name和value

时间:2020-06-19 19:15:22      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:ann   set   ace   spec   semi   structs   字符   ascii   ica   

Constructs a cookie with a specified name and value.

The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. The cookie‘s name cannot be changed after creation.

The value can be anything the server chooses to send. Its value is probably of interest only to the server. The cookie‘s value can be changed after creation with the setValue method.

By default, cookies are created according to the Netscape cookie specification. The version can be changed with the setVersion method

以上是官方对cookie的构造方法的说明。

cookie的name需要遵循规范RFC2109,只能包含字母或者数字,不能包含逗号、分号、空格及美元符号,并且名字确定后不能再更改。

cookie的value可以是服务端设置的任意值,该值可以通过setValue方法进行重新设置。

!但是value最好也只包含字母和数字,不要包含逗号、分号、空格等特殊字符!

 

cookie的name和value

标签:ann   set   ace   spec   semi   structs   字符   ascii   ica   

原文地址:https://www.cnblogs.com/da-hao/p/13164644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!