码迷,mamicode.com
首页 > 数据库 > 详细

getAccessToken by memcache

时间:2015-02-05 09:28:16      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

 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;
  }

 

getAccessToken by memcache

标签:

原文地址:http://www.cnblogs.com/yutaoyao/p/4273874.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!