2014-03-30 19:02
浏览 54


I have multiple subdomains and i'm trying to use the sessions across subdomains.

I have also set the cookie domain in config.php

$config['cookie_domain'] = "";

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

图片转代码服务由CSDN问答提供 功能建议


我还在config中设置了cookie域。 php

  $ config ['cookie_domain'] =“。”; 

会话用户数据 在其他域中使用时,flashdata也是空的。 我同时使用相同的会话表用于CI实例

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • douhu2890 2014-03-31 07:51

    From the following solution : Sharing sessions

    Both the cookie_domain and cookie prefix has to be set

    $config['cookie_domain'] = "";
    $config['cookie_prefix'] = "example_";
    解决 无用
    打赏 举报
  • doulu1020 2014-12-13 11:45

    first floor is right ,but does not clearly the reason

    Reasons: from:

    CI’s session, like any other session mechanism, uses a cookie to identify the session. It’s is the cookie that should be available cross-domain.

    For domain, you need to specify ‘’, not ‘*’.

    解决 无用
    打赏 举报
  • dongzhi6382 2017-11-07 03:45

    Only $config['cookie_domain'] part is required, $config['cookie_prefix'] is only to make things clean or you have some sub domain uses same domain but does not wanted to be shared.

    解决 无用
    打赏 举报

相关推荐 更多相似问题