首页
关于
搜索
1
微信【限制新设备登录功能】解决办法
939 阅读
2
使用Mem Reduct定时清理内存
451 阅读
3
TP6+Workerman实现聊天室功能
375 阅读
4
PlanetScale 线上免费的数据库
232 阅读
5
PHPExcel快速生成字母表
197 阅读
默认分类
搜索
标签搜索
PHP
Windows 软件
GO
TrafficMonitor
网速悬浮窗
Mem Reduct
内存
PHPExcel
PlanetScale
ZipArchive
One Note插件
Redis
FRP
内网穿透
Philip
累计撰写
20
篇文章
累计收到
1
条评论
首页
栏目
默认分类
页面
关于
搜索到
20
篇与
的结果
2023-01-12
微信【限制新设备登录功能】解决办法
刷机后重新登录微信,刚登上没多久就被强制下线,然后出现图中的问题问题就出现在 我的常用设备就是这台刚刷了机的手机,也是唯一常用的设备。张小🐉你******(优美的中国话然后我通过以下的方法申诉,当天可登录回来。记录一下步骤,以防万一需要一个已经登录的微信号,搜索公众号: 腾讯客服发送消息: 解除微信保护状态一般会回复四个选项, 选择: 系统保护冻结需要解冻按操作填写资料,进行人脸验证。等待工单处理,会有一个短信发过来。按照回复操作改密码,用新密码就可以登录了
2023年01月12日
939 阅读
0 评论
3 点赞
2022-12-15
Snipaste
截图 + 贴图工具,非常好用 Snipaste官网 2.8.2下载
2022年12月15日
129 阅读
0 评论
0 点赞
2022-12-13
Redis 键(key) PHP用法
Redis keys 命令下表给出了与 Redis 键相关的基本命令:命令描述DEL key该命令用于在 key 存在是删除 keyDUMP key序列化给定 key ,并返回被序列化的值EXISTS key检查给定 key 是否存在EXPIRE key seconds为给定 key 设置过期时间EXPIREAT key timestampEXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置过期时间。 不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)PEXPIRE key milliseconds设置 key 的过期时间亿以毫秒计PEXPIREAT key milliseconds-timestamp设置 key 过期时间的时间戳(unix timestamp) 以毫秒计KEYS pattern查找所有符合给定模式( pattern)的 keyMOVE key db将当前数据库的 key 移动到给定的数据库 db 当中PERSIST key移除 key 的过期时间,key 将持久保持PTTL key以毫秒为单位返回 key 的剩余的过期时间TTL key以秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)RANDOMKEY从当前数据库中随机返回一个 keyRENAME key newkey修改 key 的名称RENAMENX key newkey仅当 newkey 不存在时,将 key 改名为 newkeyTYPE key返回 key 所储存的值的类型{collapse}{collapse-item label="业务代码(PHP)" open}class RedisKeyDemo{ public $redis; // redis实例 public $type_list = ['Not Found', 'String', 'Set', 'List', 'Zset', 'Hash', 'Stream']; // 数据类型 public function __construct(){ $this->redis = new Redis(); } /** * 链接 Redis * @param string $host * @param int $port * @return bool */ public function connect(string $host = '127.0.0.1', int $port = 6379): bool{ return $this->redis->connect($host, $port); } /** * 打印到html * @param $str */ public function printToHtml(string $str = ''): void{ echo $str."<br>"; } /** * 打印所有keys */ public function printAllKeys(): void{ $this->keys(); } /** * 判断键是否存在 * @param string $key * @return bool|int */ public function isExists(string $key = ''): void{ $this->redis->exists($key) ? $this->printToHtml("$key is exists") : $this->printToHtml("$key is not exists"); } /** * 返回键类型 * @param string $type */ public function keyType(string $key = ''): void{ $this->printToHtml($this->type_list[$this->redis->type($key)]); } /** * 删除指定键 * 原本方法可以 key1,key2···, 接受string或array * @param string $key */ public function delKey(string $key = ''): void{ $this->printToHtml($this->redis->del($key) ? "'$key'删除成功" : "'$key'删除失败"); } /** * 为指定键设置过期时间 * @param string $key * @param int $ttl 过期时间 * @param string $type second 使用秒, timestamp 使用时间戳, milliseconds 使用时间亿以毫秒计 */ public function expiredKey(string $key = '', int $ttl, string $type = 'second'): void{ $error = "设置过期时间失败"; if ($ttl > 0){ switch ($type){ case 'second': $this->printToHtml($this->redis->expire($key, $ttl) ? "$key 将在 $ttl s 后删除" : $error);break; case 'timestamp': $this->printToHtml($this->redis->expireAt($key, $ttl) ? "$key 将在 ".date('Y-m-d H:i:s', $ttl)." 删除": $error);break; case 'milliseconds': $this->printToHtml($this->redis->pExpire($key, $ttl) ? "$key 将在 $ttl 亿以毫秒后删除" : $error);break; default: $this->printToHtml('$type: second 使用秒, timestamp 使用时间戳, milliseconds 使用时间亿以毫秒计'); } } else { $this->printToHtml($error); } } /** * 查找符合给定模式的key * 例如 查找te开头的所有key: te* ; 查找包含a的key: *a* ; 获取所有key: * * @param string $pattern */ public function keys(string $pattern = '*'): void{ $this->printToHtml(json_encode($this->redis->keys($pattern))); } /** * 将当前数据库的 key 移动到给定的数据库 db 当中 * @param string $key * @param int $db * @return bool */ public function move(string $key = '', int $db = 0): bool{ return $this->redis->move($key, $db); } /** * 移除 key 的过期时间,key 将持久保持。 * @param string $key * @return bool */ public function persist(string $key): bool{ return $this->redis->persist($key); } /** * 返回key的剩余过期时间 * @param string $key * @param string $type ttl以秒为单位, pttl以毫秒为单位 */ public function ttl(string $key, string $type = 'ttl'): void{ $error_flag = [ -1 => '没有设置过期时间', -2 => '不存在的key', false => '不存在的key' ]; switch ($type){ case 'ttl': $temp = $this->redis->ttl($key); $this->printToHtml($error_flag[$temp] ?? "剩余 $temp 秒");break; case 'pttl': $temp = $this->redis->pttl($key); $this->printToHtml($error_flag[$temp] ?? "剩余 $temp 毫秒");break; default: $this->printToHtml('$type ttl以秒为单位, pttl以毫秒为单位'); } } /** * 从数据库中随机返回一个key */ public function randomKey(){ $this->printToHtml("Random Key: ".$this->redis->randomKey()); } /** * 修改 key 的名称 * @param string $key * @param string $new_name * @param bool $strict == true时, 仅当 new_name 不存在时,将 key 改名为 new_name */ public function rename(string $key = '', string $new_name = '', bool $strict = false): void{ $flag = !$strict ? $this->redis->rename($key, $new_name) : $this->redis->renameNx($key, $new_name); $this->printToHtml($flag ? "重命名 $key->$new_name" : '重命名失败'); } }{/collapse-item}{collapse-item label="调用示例"}$demo = new RedisKeyDemo(); $demo->connect(); // 判断指定键是否存在 $demo->isExists('cao'); // 判断指定键类型 $demo->keyType('redis_yes'); $demo->keyType('myname'); // 删除键 //$demo->delKey('myname'); $demo->printAllKeys(); // 为key设置过期时间 $demo->expiredKey('test', time()+9999, 'timestamp'); // 使用时间戳 // 查找'te'开头的所有key $demo->keys('te*'); // 查看key的过期时间 $demo->ttl('test'); $demo->ttl('philip', 'pttl'); $demo->ttl('hstab'); // 移除过期时间 $demo->printToHtml('test 移除过期时间'. ($demo->persist('test') ? '成功' : '失败')); // 从数据库中随机获取一个key $demo->randomKey(); // 重命名key $demo->redis->set('test2', 5555); $demo->rename('test2', 'testt'); $demo->rename('testt', 'hstab', true); // 仅当new_name不存在时改名{/collapse-item}{/collapse}
2022年12月13日
123 阅读
0 评论
0 点赞
2022-12-12
NoteHeighlight 用于在one note上格式化代码的工具
总之就是很有用,在此保存 GitHub
2022年12月12日
66 阅读
0 评论
0 点赞
2022-12-10
在windows下为php安装redis拓展
拓展下载 php_igbinary php_redis{alert type="warning"}注意:ts表示线程安全的,nts表示非线程安全的。使用哪种版本以当前运行的环境而定。{/alert}{alert type="error"} phpinfo()里展示的信息,决定拓展文件版本 {/alert}下载好后解压,将.dll和.pdb文件拷贝至php的ext目录下修改php.ini,加入以下参数;php_redis redis拓展 extension=php_igbinary.dll extension=php_redis.dll注意extension=php_igbinary.dll一定要在前面,不然拓展不会生效重启apache,查看是否生效(如图)测试使用<?php $br = "<br>"; // 链接本地的 Redis 服务 $redis = new Redis(); echo $redis->connect('127.0.0.1', 6379) ? "Redis链接成功!$br" : "Redis链接失败!$br"; // 设置字符串数据 echo $redis->set('name', 'philip') ? "set {name} philip success!$br" : 'set {name} philip fail!$br'; echo "get name: {$redis->get('name')}$br"; // 删除字符串数据 echo $redis->del('name') ? "del name success!$br" : "del name fail!$br"; echo "get name: {$redis->get('name')}$br";
2022年12月10日
80 阅读
0 评论
0 点赞
1
2
3
4