key = $key; $this->provider = $provider; $this->init(); } public function init() { $this->curl = new Curl(); if($this->provider == 'qqmap'){ $this->plugin = new Qqmap($this); } return $this; } public function buildRequest($api, $data = [], $method = 'get') { $method = strtolower($method); if($method == 'get'){ $this->curl->get($api, $data); } if($method == 'post'){ $this->curl->post($api, $data); } } public function getUrlQuery($params = [], $prefix = '?') { $tmp = []; foreach ($params as $key => $val){ $val = trim($val); $tmp[] = "{$key}={$val}"; } $query = implode('&', $tmp); return $prefix ? $prefix . $query : $query; } }