WeChatPort.php 553 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace app\api\controller;
  3. use EasyWeChat\Factory;
  4. use EasyWeChat\MiniProgram\Application;
  5. use think\Controller;
  6. /**
  7. * 微信接口
  8. * Class WeChatPort
  9. * @package app\api\controller\WeChatPay
  10. */
  11. class WeChatPort extends Controller
  12. {
  13. // 获取微信小程序AccessToken
  14. public static function getAccessToken()
  15. {
  16. $res = http_curl('https://api.weixin.qq.com/cgi-bin/token?appid='.config('mini_program')['app_id'].'&secret='.config('mini_program')['secret'].'&grant_type=client_credential');
  17. return $res;
  18. }
  19. }