<button onclick='ShareUtil.shareToQQ({url: "",title: "",summary: "",desc: "",pics: ""})'></button>
<script>var ShareUtil = {openShareUrl: function (url) {var a = document.createElement("a");a.href = url;a.target = "_blank";a.click();},shareToQQ: function (option) {var url = "https://connect.qq.com/widget/shareqq/index.html" +"?url=" + encodeURIComponent(option.url) +"&title=" + encodeURIComponent(option.title) +"&source=" + encodeURIComponent('这里是你的网站首页地址') +"&summary=" + encodeURIComponent(option.desc) +"&pics=" + encodeURIComponent(option.pics) +"&desc=" + encodeURIComponent(option.summary);ShareUtil.openShareUrl(url);},shareToQZone: function (option) {var url = "https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey" +"?url=" + encodeURIComponent(option.url) +"&title=" + encodeURIComponent(option.title) +"&summary=" + encodeURIComponent(option.desc) +"&desc=" + encodeURIComponent(option.summary) +"&site=" + encodeURIComponent('这里是你的网站首页地址') +"&pics=" + encodeURIComponent(option.pics);ShareUtil.openShareUrl(url);}}</script>
1)shareToQQ:
| 字段 | 说明 |
|---|---|
| url | 要分享的网页地址 |
| title | 分享显示的标题 |
| source | 分享内容的来源,网站首页即可 |
| summary | 分享显示的描述 |
| pics | 分享显示的图片,可省略 |
| desc | 分享附带的文字内容,以一条文本消息的形式跟随分享的内容发送给好友 |
2)shareToQZone:
| 字段 | 说明 |
|---|---|
| url | 要分享的网页地址 |
| title | 分享显示的标题 |
| site | 分享内容的来源,网站首页即可 |
| summary | 分享显示的描述 |
| pics | 分享显示的图片,可省略 |
| desc | 分享附带的文字内容,相当于空间发说说时的文案 |
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号