在 setcookie 方法前,添加如下 header 即可

1header('P3P: CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"');
1//a.com/test
2<script src="http://b.com/get_cookie.php"></script>
1//b.com/get_cookie.php
2header('P3P: ........');
3setcookie(...)

a.com/test 可正常获取 b.com/get_cookie.phpcookie 数据