用mysql_query,mysql_fetch_array()后应该要 free_result().function count_admin($where = '') { if($where) $where = " WHERE $where"; $result = $this->db->get_one("SELECT count(*) as num FROM $this->table_admin_role $where"); return $result['num']; }