1. Go to this page and download the library: Download peteryang/wechat 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/ */
peteryang / wechat example snippets
#配置信息
$config = new \Config\Config("appid", "appSecret");
$w = new \WeChat\WeChat($config);
echo $w->getAccessToken();
new \WeChat\WeChat($config);
$user_info = $w->WebAuth()->getUserInfoByCode($_GET['code']);
print_r($user_info);
$w = new \WeChat\WeChat($config);
$accessToken = $w->getAccessToken();
echo $w->JsSdk()->getTicket($accessToken);