var curl = encodeURIComponent(window.location.href.split('#')[0]);
$.ajax({
type: "GET",
url : "https://xxxx.com/hl_jssdk.php?url=" + curl,
dataType:'jsonp',
success : function(data){
console.log(data)
wx.config({
debug:false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: ['checkJsApi','updateAppMessageShareData','updateTimelineShareData']
});
},
error:function(data){
console.log(JSON.stringify(data))
}
});
wx.ready(function () {
var option_config ={
title: '秘制泡鴨爪',
desc: '秘制泡鴨爪',
link: 'https://xxx.com/product/food/75.html',
imgUrl: 'https://xxx.com/1.jpg',
success: function () {},
cancel: function () {}
};
wx.updateTimelineShareData(option_config);
wx.updateAppMessageShareData(option_config);
});
然后我的jssdk.php文件打开后显示:
({"appId":"wx11714dfd0862df42","timestamp":1711266952,"nonceStr":"2rLZSbb4QHq6joAo","signature":"1a1dadd4c656a0477349e27f9ff9c7de36af7906","url":"https:\/\/xxx.com\/product\/food\/75.html"})
输出好像是正常的了?但是转发好友或者朋友圈的封面图和介绍都总是不出来。。白名单域名啥的也都设置的了。
请问代码哪里有问题?谢谢!!!
你好,麻烦使用xweb调试下,debug打印下是否有获取到imgurl
尝试了另外的代码方法
https://www.henenseo.com/archives/7356
也是不行,求高手。。。腾讯为何那么麻烦,这个封面图搞简单获取就不好?还得搞得这么复杂。。。