script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js">/script>
script>
wx.config({
debug: false,
appId: "{$signPackage['appId']}",
timestamp: "{$signPackage['timestamp']}",
nonceStr: "{$signPackage['nonceStr']}",
signature: "{$signPackage['signature']}",
jsApiList: [
'onMenuShareAppMessage',
'onMenuShareTimeline',
'onMenuShareQQ',
'onMenuShareWeibo',
]
});
wx.ready(function () {
var shareData = {
title: `{$info.ma_title}`,
desc: `{$info.briefcontent}`,
link: '',
imgUrl: `{$info['activity_pic']}`,
trigger: function (res) {
alert('用戶點(diǎn)擊發(fā)送給朋友');
},
success: function (res) {
alert('已分享');
},
cancel: function (res) {
alert('已取消');
},
fail: function (res) {
alert(JSON.stringify(res));
}
}
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});
/script>
require_once VENDOR_PATH."jssdk/jssdk.php";
//WX_APPID和WX_APP_SECRET填寫自己的即可
$jssdk = new \JSSDK(C("WX_APPID"),C("WX_APP_SECRET"));
$signPackage = $jssdk->getSignPackage();
$this->assign('signPackage',$signPackage);