php不同域名跨域

a.cn/index.php

<?php
session_start();
$sessId = session_id();
echo '<img src="http://b.cn/index.php?sid='.$sessId.'" width="1" height="1"/>';
var_dump($_COOKIE);

b.cn/index.php

<?php
$sessId = session_id($_REQUEST['sid']);
session_start();
var_dump($_REQUEST['sid'],$sessId);

分别打开a.cn 和 b.cn 打开控制台查看请求cookie发现两边是一样的

猜你喜欢

转载自www.cnblogs.com/changfengSven/p/9037859.html
今日推荐