WeChatPort.php 638 B

123456789101112131415161718192021222324
  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. var_dump(config('mini_program')['app_id'],config('mini_program')['secret']);
  17. $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');
  18. return $res;
  19. }
  20. }