foreach ($func_list as $val) { $func_open[$val['func_id']] = 1; } } else { $func_open[] = array(); } $data['func_open'] = json_encode($func_open); $pkey = "data|player_detail:{$info['player_id']}"; $this->redis()->hash_set($pkey, $data); } } } public function fix_player_data() { $player_ids = $this->redis()->keys("data|player:*"); foreach ($player_ids as $key) { $info = $this->redis()->hash_get($key); if (!empty($info['player_id'])) { $filter = array('exp', 'gold', 'silver', 'ticket', 'chips', 'kf_coin', 'honor', 'crystal', 'fame', 'kf_score'); $up = array(); foreach ($filter as $k) { $up[$k] = intval($info[$k]); } $this->redis()->hash_set($key, $up); } } } } $obj = new FixPosition(); $obj->fix_player_data();