redis->lPush这个方法能拿到返回值么?
打印了一下,好像什么都没有
$id = $this->post('id');
$info = $this->PushModel->getPush($id);
if(empty($info)){
$this->json(Constant::FAILURE);
}
$gameId = $info['game_id'];
$title = $info['title'];
$content = $info['content'];
$pushInfo = "$id|$gameId|$title|$content";
$redis = $this->redis();
$ret = $redis->connect(REDIS_HOST, ZGH_REDIS_PORT);
$res = $redis->lPush(REDIS_HRGAME_PUSH_BATCH_KEY,$pushInfo);
print_r($ret);
print_r($res);exit;
如果你是直接使用redis,而不是php-redis的话,根据https://redis.io/commands/lpush
Return: the length of the list after the push operations,你会得到当前list的长度
如果你使用的是php的redis扩展库,php-redis,也同样会得到一样的结果,你会得到当前list的长度
如果你确实没有获得相关的值,你不如贴上你的相关代码