Home php教程 php手册 php跨域cookie共享使用方法

php跨域cookie共享使用方法

Jun 06, 2016 pm 08:24 PM

这篇文章主要介绍了php跨域cookie共享使用方法,需要的朋友可以参考下

A 机器所在的域:a1.main.com,A 有应用 main.php
B 机器所在的域:b1.test.com,B 有应用 test.php

1.在 main.php 里设置 cookie 的时候, cookie 的设置方法如下:

复制代码 代码如下:


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


这样在 test.php 里就可以取到 cookie 。

2.输入 url 访问 test 的时候,必须输入域名才能解析。
比如输入: ,可以获取 cas 在客户端设置的 cookie ,
而 B 机器访问本机的应用,,输入: :8080/test.php 则不可以获得 cookie 。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)