vue-admin-php icon indicating copy to clipboard operation
vue-admin-php copied to clipboard

搭建完后登陆提示{"code":1,"message":"Redis link timeout","data":{}}

Open vsgeping opened this issue 6 years ago • 1 comments

登陆提示{"code":1,"message":"Redis link timeout","data":{}} 找到/application/common/utils/RedisUtils.php 里面是这么写的: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "default")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

}

修改为: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "redis")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

} 并在/config/cache.php中增加: // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], 最终/config/cache.php是这样的: return [ // 缓存配置为复合类型 'type' => 'complex', 'default' => [ // 驱动方式 'type' => 'File', // 缓存保存目录 'path' => '', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 'expire' => 0, ], // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], ];

OK,为啥这个地方在clone的时候没有呢

作者辛苦,star一下

vsgeping avatar Oct 28 '19 22:10 vsgeping

登陆提示{"code":1,"message":"Redis link timeout","data":{}} 找到/application/common/utils/RedisUtils.php 里面是这么写的: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "default")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

}

修改为: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "redis")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

} 并在/config/cache.php中增加: // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], 最终/config/cache.php是这样的: return [ // 缓存配置为复合类型 'type' => 'complex', 'default' => [ // 驱动方式 'type' => 'File', // 缓存保存目录 'path' => '', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 'expire' => 0, ], // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], ];

OK,为啥这个地方在clone的时候没有呢

作者辛苦,star一下

登陆提示{"code":1,"message":"Redis link timeout","data":{}} 找到/application/common/utils/RedisUtils.php 里面是这么写的: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "default")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

}

修改为: class RedisUtils {

/**
 * @param string $store
 * @return \Redis
 * @throws JsonException
 */
public static function init($store = "redis")
{
    $redis = Cache::store($store)->handler();
    // 判断缓存类是否为 redis
    if ($redis instanceof \Redis){
        return $redis;
    }
    throw new JsonException(1, "Redis link timeout");
}

} 并在/config/cache.php中增加: // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], 最终/config/cache.php是这样的: return [ // 缓存配置为复合类型 'type' => 'complex', 'default' => [ // 驱动方式 'type' => 'File', // 缓存保存目录 'path' => '', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 'expire' => 0, ], // redis缓存 'redis' => [ // 驱动方式 'type' => 'redis', // 服务器地址 'host' => '127.0.0.1', //redis服务器ip ], ];

OK,为啥这个地方在clone的时候没有呢

作者辛苦,star一下

可能是版本问题,我这边clone下来运行貌似没这么多问题

lmxdawn avatar Oct 29 '19 01:10 lmxdawn