PHP code example of feehi / yii2-wechat
1. Go to this page and download the library: Download feehi/yii2-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/ */
feehi / yii2-wechat example snippets
/** @var $wechat \feehi\wechat\Wechat */
$wechat = yii::$app->get('wechat');
$wechat->checkSignature(); //检验echoStr
$wechat->getServerAccessToken(); //获取服务端access_token
$wechat->createMenu(); //创建自定义菜单
$wechat->getLoginUrl(); //获取微信登陆授权url
$wechat->getAccessToken(); //获取用户access_token
$wechat->getImplicitAccessToken(); //获取隐士授权用户的access_token
$wechat->getUserInfo(); //根据用户access_token获取用户信息
$wechat->createTempMedia(); //创建临时媒体素材
$wechat->recieveWechatPush(); //接受微信推送的消息和事件
$wechat->assembleWechatResponse(); //组装需要返回给微信的xml