本文实例为大家分享了php微信分享到朋友圈、QQ、朋友、微博的具体代码,供大家参考,具体内容如下 前台代码 script src="/uploads/allimg/210520/120T63101-0.jpg"/scriptscript wx.config({ debug: false, a
本文实例为大家分享了php微信分享到朋友圈、QQ、朋友、微博的具体代码,供大家参考,具体内容如下
前台代码
<script src="http://img.558idc.com/uploadfile/allimg/210520/120T63101-0.jpg"></script> <script> wx.config({ debug: false, appId: "{$signPackage['appId']}", timestamp: "{$signPackage['timestamp']}", nonceStr: "{$signPackage['nonceStr']}", signature: "{$signPackage['signature']}", jsApiList: [ 'onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', ] }); wx.ready(function () { var shareData = { title: `{$info.ma_title}`, desc: `{$info.briefcontent}`, link: '', imgUrl: `{$info['activity_pic']}`, trigger: function (res) { alert('用户点击发送给朋友'); }, success: function (res) { alert('已分享'); }, cancel: function (res) { alert('已取消'); }, fail: function (res) { alert(JSON.stringify(res)); } } wx.onMenuShareAppMessage(shareData); wx.onMenuShareTimeline(shareData); wx.onMenuShareQQ(shareData); wx.onMenuShareWeibo(shareData); }); </script>
后台代码
jssdk.php获取地址
require_once VENDOR_PATH."jssdk/jssdk.php"; //WX_APPID和WX_APP_SECRET填写自己的即可 $jssdk = new \JSSDK(C("WX_APPID"),C("WX_APP_SECRET")); $signPackage = $jssdk->getSignPackage(); $this->assign('signPackage',$signPackage);
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。