How to implement qq sharing in php

藏色散人
Release: 2023-03-09 10:06:02
Original
2067 people have browsed it

php method to implement QQ sharing: first create a PHP sample file; then connect to the QQ Internet platform; finally implement it through "$("#zone").click(function(){...}" Just share via qq.

How to implement qq sharing in php

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

php to achieve sharing Go to QQ Space Sina Weibo

  • Share to Sina Weibo

//分享到新浪微博
            $('#blog').click(function(){
                window.sharetitle = &#39;<%$info.title%>&#39;;//标题
                window.shareUrl = &#39;__IMG__<%$info.img.0.url%>&#39;;//缩略图
                share();
            });
            function share(){
                //d指的是window
                (function(s,d,e){try{}catch(e){}var f=&#39;http://v.t.sina.com.cn/share/share.php?&#39;,u=d.location.href,p=[&#39;url=&#39;,e(u),&#39;&title=&#39;,e(window.sharetitle),&#39;&appkey=2924220432&#39;,&#39;&pic=&#39;,e(window.shareUrl)].join(&#39;&#39;);function a(){if(!window.open([f,p].join(&#39;&#39;),&#39;mb&#39;,[&#39;toolbar=0,status=0,resizable=1,width=620,height=450,left=&#39;,(s.width-620)/2,&#39;,top=&#39;,(s.height-450)/2].join(&#39;&#39;)))u.href=[f,p].join(&#39;&#39;);};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent);
            }
Copy after login
  • Share to QQ Space

//分享到QQ空间
            $("#zone").click(function(){
                var p = {
                    url:location.href,
                    showcount:&#39;1&#39;,/*是否显示分享总数,显示:&#39;1&#39;,不显示:&#39;0&#39; */
                    desc:&#39;&#39;,/*默认分享理由(可选)*/
                    summary:&#39;我在【空间家】上找到一个好位置,地段好又划算,快来看看吧!&#39;,/*分享摘要(可选)*/
                    title:&#39;<%$info.title%>&#39;,/*分享标题(可选)*/
                    site:&#39;空间家&#39;,/*分享来源 如:腾讯网(可选)*/
                    pics:&#39;__IMG__<%$info.img.0.url%>&#39;, /*分享图片的路径(可选)*/
                    style:&#39;203&#39;,
                    width:98,
                    height:22
                };
                var s = [];
                for(var i in p){
                    s.push(i + &#39;=&#39; + encodeURIComponent(p[i]||&#39;&#39;));
                }
                window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"+s.join(&#39;&&#39;));
            });
Copy after login

QQ Internet (interface related): https://connect.qq.com/

[Recommended learning: PHP video tutorial]

The above is the detailed content of How to implement qq sharing in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template