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最好也只包含字母和數字,不要包含逗號、分號、空格等特殊字符!