简体   繁体   English

如何在一个域中设置另一个域可以读取的Cookie

[英]How to set cookie in one domain that is readable by another domain

I have two domains that I want to communicate. 我有两个要交流的领域。 I want the first domain to set a cookie in the second domain telling the second domain that the current user is known to the first domain. 我希望第一个域在第二个域中设置一个cookie,以告知第二个域第一个域已知当前用户。 I understand that I cannot read cookies for another domain, but given that I have access to both, is there a way to accomplish this? 我了解我无法读取其他域的cookie,但是鉴于我可以同时访问这两个域,是否有办法做到这一点?

Both domains are implemented in PHP. 这两个域都是用PHP实现的。 One is a Drupal site and the other a WordPress site. 一个是Drupal网站,另一个是WordPress网站。

Server can't read cookie for another domain but, you can add cookie for another domain. 服务器无法读取另一个域的cookie,但是,您可以添加另一个域的cookie。 When adding cookies, you should add double cookie. 添加cookie时,应添加双cookie。 First your normal cookie and second for another domain. 首先是您的普通Cookie,其次是另一个域。 Both values are the same. 这两个值是相同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM