【发布时间】:2014-12-16 02:38:05
【问题描述】:
我刚刚开始使用 Predis 进行 Redis 迁移,但无法让 zadd 函数与数组一起使用。
此代码有效:
foreach ($userIndexArr as $row) {
$usernames[] = 0;
$usernames[] = $row['username'];
$result = $this->cache->zadd('@person', 0, $row['username']);
}
这不是:
foreach ($userIndexArr as $row) {
$usernames[] = 0;
$usernames[] = $row['username'];
}
try {
$result = $this->cache->zadd('@person', $usernames);
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
并且没有抛出错误。非常感谢任何帮助!
-J
【问题讨论】: