admin管理员组文章数量:1425760
What is the difference between key and value in html cookies?
i saw that a cookie looks like this in html request:
not like this:
Cookie: name1=key1; name2=key2;
but rather like this:
Cookie: key1=value1; key2=value2;
and if a want to make a unique personal id for each cookie, say "UUID",
should i write key="UUID"? or value="UUID"?
im sorry for the "silly" question but im really confused here...
thank you!
What is the difference between key and value in html cookies?
i saw that a cookie looks like this in html request:
not like this:
Cookie: name1=key1; name2=key2;
but rather like this:
Cookie: key1=value1; key2=value2;
and if a want to make a unique personal id for each cookie, say "UUID",
should i write key="UUID"? or value="UUID"?
im sorry for the "silly" question but im really confused here...
thank you!
Share Improve this question edited Jan 4, 2012 at 20:39 Pete Wilson 8,7046 gold badges41 silver badges52 bronze badges asked Jan 4, 2012 at 20:32 Itzik984Itzik984 16.9k29 gold badges73 silver badges110 bronze badges 1- No question is silly. As long as it's correctly asked and formatted, it's accepted here on SO. – Madara's Ghost Commented Jan 4, 2012 at 20:34
3 Answers
Reset to default 6a key-value pair is a way of storing information in an easily readable manner. You designate each piece of data (value) with a key, and reference the data with that key. So in your case, the string "UUID" would be the key, and the actual unique ID would be the value.
uuid=4dh26532gf564836fgf597g36
In your example, name1
would actually be the key, where key1
would be the value.
In layman's terms, the key is what es before the equal sign (=
), and the value is what es after it.
Keys are the names of the variables and values are, well the actual value of them. So to use your example, the key/value pair would be UUID=12345
Key value pair is a convenient way of storing structured data: the key designates the kind of information (e.g. be it a name, an identifier, a URL, a path, a hash of some data etc) and value designates a piece of data of the designated kind (e.g. "John", "1247", "http://example./", "/data/file1.txt", "4858200518452f9b374549459d644042" etc).
Thus a key is metainformation, i.e. information about information since it describes the kind of information that follows it.
Structured data is easier to analyse and use by programs since it is immediately obvious which part of the data has what meaning.
Note that in your example syntax is unconventional: it should be key=value, i.e. your keys are name1
and name2
and values are key1
and key2
.
本文标签: javascriptWhat is the difference between key and value in html cookiesStack Overflow
版权声明:本文标题:javascript - What is the difference between key and value in html cookies? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745379923a2656111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论