This article mainly introduces the PHP Cross-domain cookie sharing method of use, the need for friends can refer to the
A machine's domain: A1.main.com,a has application main.php
B machine in the domain: B1.test.com,b has applied test.php
1. When setting cookies in main.php, the cookie is set as follows:
The code is as follows:
Setcookie ("TestCookie", "Okol", Time () + 3600, "/", "b1.test.com", 1);
This allows cookies to be taken in test.php.
2. When you enter the URL to access test, you must enter a domain name to resolve.
Like input: http://b1.test.com/test.php, you can get the cookies set up by CAs on the client,
and B machine access to the application of this machine, input: http://localhost:8080/test.php can not get cookies