예제 #1
0
파일: Oauth.php 프로젝트: pakey/weixin
 /**
  * 获取access token
  *
  * @param string $code
  *
  * @return string
  */
 public function getAccessPermission($code)
 {
     $params = array('appid' => $this->appId, 'secret' => $this->appSecret, 'code' => $code, 'grant_type' => 'authorization_code');
     $res = $this->parseJSON(Http::post(self::API_TOKEN_GET . '?' . http_build_query($params)));
     if (isset($res['errorcode'])) {
         trigger_error('get access_token error: ' . $res['errormsg'], E_USER_ERROR);
     }
     return $this->lastPermission = $res;
 }