The content of this article is about how to verify whether the user has followed the public account during PHP WeChat activities. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
When we do WeChat activities, some activities require users to follow the official account before they can continue the activity or send gifts. Here we are required to verify whether the user has paid attention, so we need to use WeChat's ---- Get basic user information interface
Get basic user information (including UnionID mechanism)
Developers can obtain basic user information through OpenID. Please use https protocol.
接口调用请求说明 http请求方式: GET https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
Parameter Description
Parameter | Is it necessary | Description |
---|---|---|
access_token | is | calling interface credentials |
openid | is | The identification of ordinary users, unique to the current public account |
lang | No | Return to the country and region language version, zh_CN simplified, zh_TW traditional, en English |
This interface only needs to pass in the token of your official account and the user's openid to obtain the user's basic information
Parameter | Description |
---|---|
subscribe | Whether the user subscribes to the public account ID, when the value is 0, It means that this user has not followed the official account and cannot retrieve other information. |
openid | The user’s identifier, unique to the current public account |
nickname | The user’s nickname |
sex | The gender of the user, when the value is 1, it is male, when the value is 2, it is female, when the value is 0, it is unknown |
city | The city where the user is located |
country | The country where the user is located |
province | Province where the user is located |
language | The user’s language, simplified Chinese is zh_CN |
headimgurl | User avatar, the last value represents the square avatar size (0, 46, 64, 96, 132 values are available, 0 represents a 640*640 square avatar), this item is empty when the user does not have an avatar. If the user changes their avatar, the original avatar URL will be invalid. |
subscribe_time | The time the user pays attention to is the timestamp. If the user has followed multiple times, the last follow time |
unionid | will only appear after the user binds the official account to the WeChat open platform account. field. |
remark | Remarks from public account operators to fans. Public account operators can add comments to fans in the WeChat public platform user management interface |
groupid | The group ID of the user (compatible with the old user group interface) |
tagid_list | The tag the user is tagged with ID list |
Return to the source of channels that users follow, ADD_SCENE_SEARCH public account search, ADD_SCENE_ACCOUNT_MIGRATION public account migration, ADD_SCENE_PROFILE_CARD business card sharing, ADD_SCENE_QR_CODE scan QR code, ADD_SCENE | PROFILELINK Click on the name in the graphic page, ADD_SCENE_PROFILE_ITEM menu in the upper right corner of the graphic page, ADD_SCENE_PAID and follow after payment, ADD_SCENE_OTHERS Others |
two-dimensional Code scanning scene (developer customization) | |
QR code scanning scene description (developer customization) |
php implements WeChat public platform account custom menu class, public account
php implements WeChat public Unlimited mass sending of accounts, mass sending of php letters to the public
The above is the detailed content of How to verify whether the user has followed the official account during WeChat activities in php. For more information, please follow other related articles on the PHP Chinese website!