Ejemplo n.º 1
0
 /**
  * @descrpition 获取微信ACCESS_TOKEN
  * @return Ambigous|bool
  */
 public static function getAccessToken()
 {
     $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . WECHAT_APPID . '&secret=' . WECHAT_APPSECRET;
     $accessToken = CurlBusiness::callWebServer($url, '', 'GET');
     if (!isset($accessToken['access_token'])) {
         return MsgCommon::returnErrMsg(MsgConstant::ERROR_GET_ACCESS_TOKEN, '获取ACCESS_TOKEN失败');
     }
     $accessToken['time'] = time();
     //存入SESSION
     Response::setSession('wechat_access_token', $accessToken);
     return $accessToken;
 }