cookie的name和value
Posted da-hao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cookie的name和value相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
php创建了cookie怎么判断的是不是存在和cookie的值
怎么设置cookie,怎么设置cookie以及删除cookie和cookie详解