redis->lPush这个方法能拿到返回值么?

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;

             
蓝山帝景
浏览 1384回答 3
3回答

阿晨1998

通常来说,应该会返回一个整型的值,也就是列表的长度,如果什么都没有,我建议你: try { $redis->lPush(); } catch(\Exception $e) { var_dump('异常:' . $e->getMessage); } catch(\Error $e) { var_dump('错误:' . $e->getMessage); }
打开App,查看更多内容
随时随地看视频慕课网APP