-1

如果我为我的域 (www.mydomain.com) 制作 cookie 并将其命名为“kolac”= $_COOKIE[“kolac”]。但是,如果其他站点的 cookie 与我的名称相同,该怎么办。它会取代我的cookie吗?我不明白它是如何工作的。

还有一个问题。我可以在我的 cookie 中存储哪些信息?

4

1 回答 1

1

A cookie can only be set and is only accessible to the domain of the request so if there is a cookie set by a different domain with the same key as your cookie, you will not be able to access it. Also, it will not replace your cookie since those two values are stored in physically different files on your computer and can only be accessed by the domain that created the cookie.

A cookie can only store text information up to 4K for the entire cookie. You can still serialize other types of data into text, but generally you only want to store basic text values in a cookie.

于 2013-03-11T20:32:55.743 回答