获取用户信息
//$_W[‘uniacid’] 获取当前公众号的id
$userinfo = mc_oauth_userinfo($_W[‘uniacid’]) //获取用户的信息
自定义分享
//方法
$account_api = WeAccount::create();
$jssdk = $account_api->getJssdkConfig();
//前台模版
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
wx.config({
debug: false,
appId: '{$jssdk['appId']}',
timestamp: '{$jssdk['timestamp']}',
nonceStr: '{$jssdk['nonceStr']}',
signature: '{$jssdk['signature']}',
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
});
wx.ready(function () {
var shareData = {
title: '符文浩吧',
desc: '这里是描述',
link: 'https://www.fuwenhao.com/',
imgUrl: "{php echo MODULE_URL;}template/mobile/zd_cion01.png",
success: function (res) {
alert('已分享');
},
cancel: function (res) {
}
};
wx.onMenuShareAppMessage({
title: '符文浩',
desc: '这里是描述',
link: 'https://www.fuwenhao.com/',
imgUrl: "{php echo MODULE_URL;}template/mobile/zd_cion01.png",
trigger: function (res) {
// alert('用户点击发送给朋友');
},
success: function (res) {
alert('已分享');
},
cancel: function (res) {
alert('已取消');
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
wx.onMenuShareTimeline(shareData);
});
wx.error(function (res) {
alert("error: " + res.errMsg);
});
</script>
还没有评论,来说两句吧...