跨子域的代码段会话 [英] Codeigniter sessions across sub domains
本文介绍了跨子域的代码段会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有多个子网域,我想使用跨子网域的工作阶段。
I have multiple subdomains and i'm trying to use the sessions across subdomains.
http://example.com
http://subdomain.example.com
config.php
I have also set the cookie domain in config.php
$config['cookie_domain'] = ".example.com";
会话userdata和flashdata在其他域中使用时为空。 Im使用相同的会话表以及CI实例
The session userdata and also flashdata are empty when used in the other domain. Im using the same session table as well for both CI instance
推荐答案
从以下解决方案:分享会话
cookie_domain和cookie前缀必须设置
Both the cookie_domain and cookie prefix has to be set
$config['cookie_domain'] = ".example.com";
$config['cookie_prefix'] = "example_";
这篇关于跨子域的代码段会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文