准备工作
微信服务号一个,并且已经通过了实名认证;
一个 ICP 备案的域名;
操作步骤
1、查看 AppId,AppSecret 以及绑定域名
织梦DedeCMS文章微信分享带缩略图与简介-创客云" title="织梦DedeCMS文章微信分享带缩略图与简介-创客云" data-original="https://22vd.oss-cn-shenzhen.aliyuncs.com/wp-content/uploads/2019/01/2019010613033464.png" src="http://bg.artuion.com/content/uploadfile/201906/92867ab04b1b76383b21b0879efc396b20190604014037.png" class="aligncenter size-full wp-image-39078" style="display:block;" width="976" height="640" />
2、文章内容页模板微信分享代码
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script type="text/javascript">
var url = encodeURIComponent(location.href.split("#")[0]);
$.ajax({
type: "get",
url: "https://www.dedehtml.com/wechat.php?link=" + url,
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function(e) {
var d = e.appid,
i = e.timestamp,
t = e.noncestr,
n = e.signature;
wx.config({
debug: 0,
appId: d,
timestamp: i,
nonceStr: t,
signature: n,
jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage"]
}),
wx.ready(function() {
wx.onMenuShareTimeline({
title: "{dede:field.title/}",
desc: "{dede:field.description/}",
link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}",
imgUrl: "{dede:global.cfg_basehost/}{dede:field.litpic/}"
}),
wx.onMenuShareAppMessage({
title: "{dede:field.title/}",
desc: "{dede:field.description/}",
link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}",
imgUrl: "{dede:global.cfg_basehost/}{dede:field.litpic/}"
})
})
}
});
</script>
- 1) 和 2) 网站不是 https 的要把它改成 http
-
- 3) 域名换成自己的域名
-
- 3、wechat.php 文件下载,放在网站根目录
附件下载:
wechat.zip 1.21KB
wechat.zip 1.21KB
版权所有:《太阳花工作室》 => 《织梦DedeCMS文章微信分享带缩略图与简介》
本文地址:http://bg.artuion.com/杂七杂八/366.html
除非注明,文章均为 《太阳花工作室》 原创,欢迎转载!转载请注明本文地址,谢谢。
