文件名称:redis使用方法
文件大小:44KB
文件格式:RAR
更新时间:2021-06-21 10:36:56
redis
D:\>cd D:\Program Files\Redis D:\Program Files\Redis> redis-cli.exe -h 127.0.0.1 -p 6379 127.0.0.1:6379> set name xxx 127.0.0.1:6379> get name flushdb 常用方法: hmset() 命令用于同时将多个 key-value (字段-值)对设置到哈希表中 incr() key中的值进行自增1 使用方法: { $uid=$redis->incr('userid'); $arr=[ 'uid' => $uid, 'username' => "测试~", 'password' => 'b', 'addtime' => time() ]; $redis->hmset("user:".$uid,$arr); } Windows下安装phpRedis扩展 { 下载redis扩展 ts https://windows.php.net/downloads/pecl/releases/redis/2.2.7/ 下载igbinary扩展 https://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/ 将解压的扩展文件放入D:\wamp64\bin\php\php5.6.25\ext中,即php_redis.dll 打开D:\wamp64\bin\php\php5.6.25\php.ini 添加:extension=php_redis.dll 重启apache } extension=php_igbinary.dll extension=php_redis.dll Thread Safety enabled =============》ts https://www.cnblogs.com/shynshyn/p/7083965.html Yii::$app->redis->set('activity_goods:'.$value['goods_id'],json_encode($value)); $keys = Yii::$app->redis->keys('activity_goods:*'); foreach($keys as $key){ Yii::$app->redis->del($key); } $activity = Yii::$app->redis->get('activity_goods:' . $goods_id); $arr = json_decode($activity, true);
【文件预览】:
redis课件
----php版本.png(31KB)
----redis版本.png(15KB)
----0-2Redis的搭建.php(1KB)