For example, if we want to use a cookie under www.jb51.net, we only need to set a cookie in the file below this site.
But if we want to implement the cookie set under the first-level domain name and use it under the second-level domain name, what should we do?
For example, if a top-level domain name is a website such as www.jb51.net, there is a second-level domain name such as bbs.jb51.net.
We want to keep the cookie to the second-level domain name after logging on to the first-level domain name, that is, to achieve synchronous login,
So how do we set this cookie ?? It is actually very simple.
For the domain name www.jb51.net, we can set the cookie as follows: setcookie ("fangbinbin", "mengfei", time () + 3600 ,"/", "jb51.net ");
Then we can directly use (echo $ _ COOKIE ['fangbinbinbinbinbin'];) under www.jb51.net and bbs.jb51.net to output the set cookie value.
This solves the problem of synchronous login !!