🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
**目录 (Table of Contents)** [TOC] ## 获取微信API令牌 (全局access_token) ```PHP $wxConfigure = new WechatConfig(); $wxConfigure->setParameter("appid",YourAppID); $wxConfigure->setParameter("appsecret",YourSecret); $wxServerApi = new WechatServerApi($wxConfigure); try { $accessTokenResults = $wxServer->getAccessToken(); // 保存 access_token 到数据库, $access_token = $accessTokenResults['access_token']; $expires_in = $accessTokenResults['expires_in']; // 存数据库操作 } catch(WechatException $e) { echo $e->errorMessage(); } ```