Esempio n. 1
0
 /**
  * 检查access_token是否起作用
  */
 public static function checkAccessToken()
 {
     if (self::$access_token_endtime === null || self::$access_token_endtime < time()) {
         //            重新申请access_token
         $json = file_get_contents(self::BASE_WEIXIN_URL . self::TOKEN_URL . "&appid=" . self::APPID . "&secret=" . self::APPSECRET);
         if ($json) {
             $result = json_decode($json, true);
             self::$access_token = $result['access_token'];
             self::$access_token_endtime = time() + $result['expires_in'];
         }
     }
 }