【发布时间】:2023-01-02 05:52:09
【问题描述】:
我试过使用 php 它给出了预期的结果
<?php
$redis = new redis();
$redis->connect("192.16.200.38", 6378);
$redis->select(2);
$result = $redis->hGetAll($key . "myCode");
print_r($result);
但在节点 js 的情况下没有给出预期的结果
const client = redis.createClient({
host: "192.16.200.38",
port: 6379
});
client.on('connect', () => {
console.log('Connected to Redis');
});
client.on('error', (err) => {
console.log("\n\nError" + err);
})
await client.connect();
await client.select(2);
const x = await client.hGetAll(key + 'myCode');
console.log(x);
但是在节点的情况下它没有给出结果而不是它给出的结果
- 服务器在端口 8000 上启动
- 连接到 Redis
- [对象:空原型] {}
【问题讨论】: