微信分享的问题,哪位大神能帮忙看看么?用的是下面的代码,微信里也设置了js安全域名了,在后台的微信模块里也填了了AppId和AppSecret
{php \Phpcmf\Service::C()->init_file('weixin');$signPackage = \Phpcmf\Service::L('jssdk', 'weixin')->GetSignPackage();}
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
wx.config({
debug: false,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
// 是否启用调试
jssdkconfig.jsApiList = [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
];
wx.ready(function () {
// 在这里调用 API
wx.onMenuShareTimeline({
title: '{$title}', // 分享标题
desc: '{$description}', // 分享描述
link: '{dr_now_url()}', // 分享链接
imgUrl: '{dr_get_file($thumb)}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareAppMessage({
title: '{$title}', // 分享标题
desc: '{$description}', // 分享描述
link: '{dr_now_url()}', // 分享链接
imgUrl: '{dr_get_file($thumb)}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareQQ({
title: '{$title}', // 分享标题
desc: '{$description}', // 分享描述
link: '{dr_now_url()}', // 分享链接
imgUrl: '{dr_get_file($thumb)}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareQZone({
title: '{$title}', // 分享标题
desc: '{$description}', // 分享描述
link: '{dr_now_url()}', // 分享链接
imgUrl: '{dr_get_file($thumb)}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});