PHP code example of zoujingli / think-plugs-wechat-service

1. Go to this page and download the library: Download zoujingli/think-plugs-wechat-service library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zoujingli / think-plugs-wechat-service example snippets


// 开放平台SDK调用入口
use plugin\wechat\service\AuthService;

// 1. 实例公众号 APPID 的 User 接口
$user = AuthService::WeChatUser(APPID);

// 2. 获取公众号 APPID 的粉丝列表( 第一页 100 条 )
$userList = $user->getUserList();
var_dump($userList);

// 3. 获取公众号 APPID 的 OPENID 资料
// 现在调用此接口获取不到粉丝详情资料
$userInfo = $user->getUserInfo(OPENID);
var_dump($userInfo);

// 其他 WeChatDeveloper 的接口实例以此类推
// 具体接口实例对象可以阅读SDK的源码或对应文档