Home > Backend Development > PHP Tutorial > How to use php cross-domain cookie sharing_PHP tutorial

How to use php cross-domain cookie sharing_PHP tutorial

WBOY
Release: 2016-07-13 10:24:58
Original
1459 people have browsed it

The domain where machine A is located: a1.main.com, A has application main.php
The domain where machine B is located: b1.test.com, B has application test.php

1. When setting cookies in main.php, the cookie setting method is as follows:

Copy the code The code is as follows:

setcookie( "TestCookie", "okol", time() + 3600, "/", "b1.test.com", 1 );

This way in test.php Cookies can be retrieved.

2. When entering the url to access test, you must enter the domain name for resolution.
For example, enter: http://b1.test.com/test.php to get the cookie set by cas on the client.
And machine B accesses the local application, enter: http://localhost: 8080/test.php cannot obtain cookies.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825282.htmlTechArticleThe domain where A machine is located: a1.main.com, A has application main.php The domain where B machine is located: b1.test.com, B has application test.php 1. When setting cookies in main.php, how to set cookies...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template