织梦DedeCMS文章微信分享带缩略图与简介
以下代码由PHP站长网 52php.cn收集自互联网现在PHP站长网小编把它分享给大家,仅供参考 准备工作微信服务号一个,并且已经通过了实名认证; 一个 ICP 备案的域名; 操作步骤1、查看 AppId,AppSecret 以及绑定域名 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/}", imgUrl: "{dede:global.cfg_basehost/}{dede:field.litpic/}" }) }) } }); </script> 1) 和 2) 网站不是 https 的要把它改成 http 3) 域名换成自己的域名 3、wechat.php 文件下载,放在网站根目录 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |