【问题标题】:CodeIgniter ion_auth with multiple websiteCodeIgniter ion_auth 与多个网站
【发布时间】:2013-04-13 10:21:11
【问题描述】:

我有两个网站并使用 ion auth 作为登录系统

CI 结构如下:

CI_BASE
    - system
    - application
        - site1
            - application
                - config
                - controllers
                - view
                - ...
        - site2
            - application
                - config
                - controllers
                - view
                - ...

现在我想使用 site1 作为主要会员页面

但site2也可以读取site1会话并将数据更新到服务器

site1 domain are:http://1.mysite.com/

site2 domain are:http://2.mysite.com/

如何连接两个具有相同身份验证的网站?

【问题讨论】:

    标签: php codeigniter authentication ion-auth


    【解决方案1】:

    虽然不是一个好的做法,但数据库(如果您使用它)和会话配置必须相同。

    文件:site1/application/config.php、site2/application/config.php

    $config['sess_cookie_name'] = 'site_cookie'; // Important! Must be the same name in both sites
    $config['sess_expiration'] = 7200;
    $config['sess_expire_on_close'] = FALSE;
    $config['sess_encrypt_cookie'] = TRUE;
    $config['sess_use_database'] = TRUE; // If you work with database
    $config['sess_table_name'] = 'sessions'; // Important! Must be the same table
    $config['sess_match_ip'] = FALSE;
    $config['sess_match_useragent'] = TRUE;
    $config['sess_time_to_update'] = 300;
    

    剩下的就是你的界面和前端了。

    【讨论】:

      猜你喜欢
      • 2013-06-08
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多