public function quitAction() { $rid = trim($_POST['rid']); $roomModel = new RoomModel(); $room = $roomModel->getRoomById($rid); $userlist = json_decode($room['user_list'], true); $userlist = $userlist ? $userlist : array(); if (!isset($userlist[$this->uid])) { $this->echoJson(true, $rid); } else { $res = $roomModel->removeUser($rid, $userlist, $this->uid); if ($res) { $this->echoJson(true, $rid); } else { $this->echoJson(false, "db fail"); } } }