求助:一个服务器里放两个xiuno的网站开启Redis怎么防止两个站缓存串联
流口水的鱼 1月前

求助:一个服务器里放两个xiuno的网站开启Redis怎么防止两个站缓存串联

最新回复 (7)
全部楼主
  • useie
    1月前 2
    0

    把数据库的会员字段进行共享,这样用户在任意一个站注册,两个站都增加会员数,但是发布内容还是独立的,购买的类似VIP,或者积分等也共享。

    内容设置不同的前缀,应该就没问题了。

  • a961223
    1月前 3
    0
        第一步:
        conf.php
        修改一下内容
       
        'redis' =>
        array (
          'host' => 'localhost',
          'port' => '6379',
          'cachepre' => 'bbs_',
          'db' => 1, //这个为redis 的数据库0-1-2-3-4-5-6 默认是0
      ),
        第二步
    找到xiunophp中的以下文件
        cache_redis.class.php
        的
           
    public function connect() {
                    if($this->link) return $this->link;
                    $redis = new Redis;
                    $r = $redis->connect($this->conf['host'], $this->conf['port']);
                    if(!$r) {
                            return $this->error(-1, '连接 Redis 服务器失败。');
                    }
                    //$redis->select('xn');
                    $this->link = $redis;
                    return $this->link;
            }


            改为
         
     public function connect() {
                    if($this->link) return $this->link;
                    $redis = new Redis;
                    $r = $redis->connect($this->conf['host'], $this->conf['port']);
                    if(!$r) {
                            return $this->error(-1, '连接 Redis 服务器失败。');
                    }
                    // 使用配置的数据库编号
                    if(isset($this->conf['db'])) {
                            $redis->select($this->conf['db']);
                    }
                    $this->link = $redis;
                    return $this->link;
            }
  • 流口水的鱼 楼主
    1月前 4
    0
    a961223     第一步:     conf.php     修改一下内容 &am ...
    我试了一下··还是在db0里面,缓存不到db1
  • a961223
    1月前 5
    0
    流口水的鱼 我试了一下··还是在db0里面,缓存不到db1
    开启调试模式后,刷新就可以了
  • 流口水的鱼 楼主
    1月前 6
    0
    a961223 开启调试模式后,刷新就可以了
    还是不行,我放弃了```
  • nanianyujian
    1月前 7
    0

    把前缀bbs改成别的。另外WordPress网站也是一样的。

  • ericlx
    9天前 8
    0
    不错的帖子!
返回