How to share cookies for different domain names is as follows: Cookies for different domain names cannot be shared. However, if you are talking about the same level-1 domain name, you can. Set cookiepath as A. top-level domain name. Reference: Cookies of different domain names cannot be shared. However, if you are talking about the same level-1 domain name, you can. How to share cookies with cookiepat with different domain names
Example
------ Solution --------------------
Cookies for different domain names cannot be shared.
However, if you are talking about the same level-1 domain name, you can. Set cookie path to. top-level domain name
------ Solution --------------------
Discussion
Reference:
Cookies for different domain names cannot be shared.
However, if you are talking about the same level-1 domain name, you can. Set cookie path to. top-level domain name
What I'm talking about is completely different. some websites have done it and I don't know how to do it.
------ Solution --------------------
Let's talk about the scenarios of some websites. maybe they may not use shared cookies?
Discussion
Reference:
Cookies for different domain names cannot be shared.
However, if you are talking about the same level-1 domain name, you can. Set cookie path to. top-level domain name
What I'm talking about is completely different. some websites have done it and I don't know how to do it.
------ Solution --------------------
Assume that there are domain names www.a.net and www. B .net.
Each domain name has a cookie. php file.
PHP code
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');if(isset($_GET['token'])) { setcookie('name', $_GET['token'] . ' ' . $_SERVER['HTTP_HOST']); echo "document.write('
js cookie:'+document.cookie+'
');";}else { print_r($_COOKIE); $url = $_SERVER['HTTP_HOST'] == 'www.a.net' ? 'www.b.net' : 'www.a.net'; echo "