private function getAccessToken() { $memcache_obj = memcache_connect("localhost", 11211); $access_token=$memcache_obj->get(‘access_token‘); if(!$access_token){ $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$this->appId&secret=$this->appSecret"; $res = json_decode($this->httpGet($url)); $access_token = $res->access_token; if ($access_token) { $memcache_obj->set(‘access_token‘, $ticket, false, 7000); } } return $access_token; }
时间: 2024-10-14 00:43:09