如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
获取用户信息
//$_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: '来51cto学习吧', desc: '51cto有好多经常的课程哦', link: 'https://minbang.bendilaosiji.com/', imgUrl: "{php echo MODULE_URL;}template/mobile/zd_cion01.png", success: function (res) { alert('已分享'); }, cancel: function (res) { } }; wx.onMenuShareAppMessage({ title: '来51cto学习吧', desc: '51cto有好多经常的课程哦', link: 'https://minbang.bendilaosiji.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>
<code class=" line-numbers"></code>
<code class=" line-numbers"></code>