PHP session cookie sessionid
in PHP i used session and cookie not urlrewriting with PHPSESSID. but when i opened cookie then i saw the key value pair.but one of them is path : /
what does path mean,can you explain elabor开发者_如何学Pythonately. if i change the path value to /abc/cdddddddddd/efc then what does that mean?
Actually, that's part of a standard cookie
Domain and path
Each cookie also has a domain and a path. The domain tells the browser to which domain the cookie should be sent. If you don't specify it, it becomes the domain of the page that sets the cookie, in the case of this page
www.quirksmode.org
. Please note that the purpose of the domain is to allow cookies to cross sub-domains. My cookie will not be read bysearch.quirksmode.org
because its domain iswww.quirksmode.org
. When I set the domain toquirksmode.org
, the search sub-domain may also read the cookie. I cannot set the cookie domain to a domain I'm not in, I cannot make the domainwww.microsoft.com
. Onlyquirksmode.org
is allowed, in this case.The path gives you the chance to specify a directory where the cookie is active. So if you want the cookie to be only sent to pages in the directory
cgi-bin
, set the path to/cgi-bin
. Usually the path is set to/
, which means the cookie is valid throughout the entire domain. This script does so, so the cookies you can set on this page will be sent to any page in thewww.quirksmode.org
domain (though only this page has a script that searches for the cookies and does something with them).Source
You may want to read more about cookies.
精彩评论