redis 的 hExists 方法是用于检查哈希表中,指定键是否存在。
用法为:
$redis->hExists('key', 'field');
其中,'key' 是哈希表的键名,'field' 是哈希表中的字段名。如果指定的字段存在,则返回 true;否则返回 false。
例如:
$redis->hSet('myhash', 'field1', 'hello'); $redis->hExists('myhash', 'field1'); // 返回 true $redis->hExists('myhash', 'field2'); // 返回 false