You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
713 B

<?php
namespace tencent\qq;
use EasyWeChat\Factory;
class Auth extends Base
{
/**
* QQ小程序通过CODE获取用户OPENID
* @date 2021-07-01
* @param string $code 授权码
* @link https://q.qq.com/wiki/develop/miniprogram/server/open_port/port_login.html#code2session
*/
public function getOpenid($code)
{
$app_id = $this->mpqqConfig['app_id'];
$app_secret = $this->mpqqConfig['app_secret'];
$url = "https://api.q.qq.com/sns/jscode2session?appid=$app_id&secret=$app_secret&js_code=$code&grant_type=authorization_code";
$result = http_data_get($url);
platformLog([], $result,'get_openid_by_code');
return $result;
}
}