예제 #1
0
 /**
  * 请求服务器jsapi_ticket
  * @param string $type
  * @return array|bool
  */
 protected function requestJsApiTicket($type = 'jsapi')
 {
     $http = new Http();
     $result = $http->httpGet(self::WECHAT_JS_API_TICKET_PREFIX, ['access_token' => $this->getAccessToken(), 'type' => $type]);
     return isset($result['ticket']) ? $result : false;
 }
예제 #2
0
 /**
  * 检验授权凭证(access_token)是否有效
  * @param $accessToken
  * @param $openId
  * @return bool
  */
 public function checkOauth2AccessToken($accessToken, $openId)
 {
     $http = new Http();
     $result = $http->httpGet(self::WECHAT_SNS_AUTH_PREFIX, ['access_token' => $accessToken, 'openid' => $openId]);
     return isset($result['errmsg']) && $result['errmsg'] == 'ok';
 }