PHP code example of esd / wechat-plugin
1. Go to this page and download the library: Download esd/wechat-plugin 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/ */
esd / wechat-plugin example snippets
app/Application 的 main 中添加插件
public static function main()
{
$application = new GoApplication();
$application->addPlug(new WeChatPlugin());
$application->run();
}
use GetWeChat;
//获取公众号实例
$wechat = $this->getOfficialAccount();
use ESD\Plugins\WeChat\Exception\OfficialAccountError;
use ESD\Plugins\WeChat\Exception\RequestError;
try {
$list = $wechat->user()->list(); #获取粉丝列表
} catch (RequestError $requestError){
} catch (OfficialAccountError $error){
}