yii2-wechat ¶
Yii2 微信æ©å±
æ¬æ©å±ä¼åäºå¾®ä¿¡ç½é¡µæææµç¨
åºäº overtrue/wechat.
å®è£ ¶
composer require huijiewei/yii2-wechat
é ç½® ¶
å¢å component
é
ç½®å° config/main.php
:
'components' => [
// ...
// componentId å¯ä»¥èªå®ä¹å¤ä¸ªå¾®ä¿¡å
¬ä¼å·è¿è¡é
ç½®
'wechat' => [
'class' => 'huijiewei\wechat\Wechat',
// 'appConfig' => [], # å
¬ä¼å·é
ç½®
// 'paymentConfig' => [], # æ¯ä»é
ç½®
// 'miniProgramConfig' => [], # å°ç¨åºé
ç½®
// 'openPlatformConfig' => [], # å¼æ¾å¹³å°é
ç½®
// 'workConfig' => [], # ä¼ä¸å¾®ä¿¡é
ç½®
],
// ...
]
é ç½®æ°æ®åº ¶
php yii migrate --migrationPath=@vendor/huijiewei/yii2-wechat/src/migrations
ç¨æ³ ¶
微信ç½é¡µææ: ¶
if(Wechat::getIsWechatClient()) {
$wechatAuthorize = new WechatAuthorize([
'wechat' => 'wechat', // componentId, é»è®¤æ¯ wechat
]);
if(!$wechatAuthorize->isAuthorized()) {
return $wechatAuthorize->authorizeRequired()->send();
}
}
JSSDK ¶
WechatShareWidget::widget([
'wechat' => 'wechat', // componentId, é»è®¤æ¯ wechat
'shareUrl' => 'å享é¾æ¥',
'shareIcon' => 'å享å¾æ ',
'shareTitle' => 'å享æ é¢',
'shareDescription' => 'å享æè¿°',
]);
æ´å¤ææ¡£ ¶
æ¥é EasyWeChat ææ¡£.
æè°¢ overtrue/wechat
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.