微信如何区分静默和非静默获取openid的方法?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1212个文字,预计阅读时间需要5分钟。
不知道大家有没有使用过微信的openid,但今天小编要带大家了解一下如何使用PHP获取微信openid。以下是获取微信openid的静态默认和非默认方法的简要说明,需要的伙伴可以参考参考。
静态默认方法:
1.首先需要配置微信公众号的设置,获取AppID和AppSecret。
2.使用以下PHP代码获取静态默认openid:
$url=https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code;$result=json_decode(file_get_contents($url), true);$openid=$result['openid'];
echo $openid;?>
非默认方法:
1.同样需要配置微信公众号的设置,获取AppID和AppSecret。
本文共计1212个文字,预计阅读时间需要5分钟。
不知道大家有没有使用过微信的openid,但今天小编要带大家了解一下如何使用PHP获取微信openid。以下是获取微信openid的静态默认和非默认方法的简要说明,需要的伙伴可以参考参考。
静态默认方法:
1.首先需要配置微信公众号的设置,获取AppID和AppSecret。
2.使用以下PHP代码获取静态默认openid:
$url=https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code;$result=json_decode(file_get_contents($url), true);$openid=$result['openid'];
echo $openid;?>
非默认方法:
1.同样需要配置微信公众号的设置,获取AppID和AppSecret。

