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

这篇文章主要介绍了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
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

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function