1. Go to this page and download the library: Download thanatosxia/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/ */
class EventMessageHandle extends MessageHandler
{
// 在执行处理之前会被执行,如果返回false则不继续执行
public function beforeHandle()
{
return parent::beforeHandle();
}
// 默认的消息处理方法
public function handleDefault()
{
$string = 123 . Yii::$app->user->id;
return $string;
}
public function getUnionid()
{
return $this->wechatInfo->unionid;
}
// 处理用户关注事件
public function eventSubscribe()
{
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.