跨多个域(非子域)的PHP会话 [英] PHP Sessions across multiple domains (not subdomains)

查看:61
本文介绍了跨多个域(非子域)的PHP会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行设置,因此,如果您使用codeigniter登录到我的网站,则该会话将转移到我多个网站的其他域(而非子域)中。例如,如果您转到domain.com并登录,然后再转到domain2.com,则您已经登录到domain2.com。

I'm trying to set it up so if you log in to my website (using codeigniter) the session carries over to other domains (not subdomains) of my multiple websites. For example, if you go to domain.com and log in, then go to domain2.com, you'll already be logged in at domain2.com.

我不能弄清楚从哪里开始。

I cannot figure out where to start.

推荐答案

想到的第一种方法是使用一个共享数据库来保存已登录 '标志,表示每个域都将轮询和更新。不能选择使用Cookie,因为它们已绑定到域。

First approach that comes to mind would be using a shared database that would hold the 'logged in' flag, that each domain would poll and update. Using cookies is not an option as they are bound to the domain.

这篇关于跨多个域(非子域)的PHP会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆