<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script>
wx.config({
debug: false,
appId: '<?php echo $wxconfig["appId"];?>',
timestamp: <?php echo $wxconfig["timestamp"];?>,
nonceStr: '<?php echo $wxconfig["nonceStr"];?>',
signature: '<?php echo $wxconfig["signature"];?>',
jsApiList: [
'updateAppMessageShareData',
'updateTimelineShareData'
]
});
wx.ready(function () {
var options = {
title: 'GlobalParagons',
link: 'http://www.globalparagons.com/',
imgUrl: 'http://www.globalparagons.com/themes/default/public/news/images/logo.png', //必须使用绝对路径
desc: 'GlobalParagons',
success: function(){
console.info('分享成功!');
},
cancel: function(){
console.info('取消分享');
}
}
wx.updateAppMessageShareData(options);
wx.updateTimelineShareData(options);
});
</script>
ip白名单,js安全域名都有设置。 debug开启时updateAppMessageShareData、updateTimelineShareData显示成功。