/** * 删除制定key的配置,支持多个 * * @param string/array $key * @param string $type * @return boolean */ public function delete($key, $type = '') { $db = new Database($this->database); $type = (string) $type; try { if (is_array($key)) { # 多个key $db->where('type', $type); $db->and_where_open(); foreach ($key as $k) { $db->or_where('key_md5', $k); if ($this->config) { unset($this->config[$type][$k]); } } $db->and_where_close(); $db->delete(); } else { # 单个key $db->delete($this->tablename, array('type' => $type, 'key_md5' => md5($key))); if ($this->config) { unset($this->config[$type][$key]); } } // 删除缓存 $this->clear_cache(); return true; } catch (Exception $e) { return false; } }