如何使用PHP将图像和内容标题分享到社交媒体? [英] How do I share the images and the title of the content to social media using PHP?

查看:76
本文介绍了如何使用PHP将图像和内容标题分享到社交媒体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我创建了一个网页,我需要通过社交媒体向用户分享一些内容,我尝试过,



Hi all,

I've created one web page in that I need to share some contents to the users via social media for that I've tried,

<ul class='share-story'>
<?php $site_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 

echo "<li><a class='tips' data-title='Facebook' href='http://www.facebook.com/sharer.php?u=  ".$site_url."&title=Welcome to our Blog' rel='nofollow' target='_blank'><img src='https://lh4.googleusercontent.com/-ZLBXhszmKcM/UhRopVveCXI/AAAAAAAACgk/A4UMB2mIVpc/s33/fb.jpg'/></a></li>";


echo "<li><a class='tips' data-title='Linkedin' href='https://www.linkedin.com/cws/share?url=".$site_url." '><img src='https://lh6.googleusercontent.com/-ffL-1GnpCbQ/UhRoqObh1DI/AAAAAAAACg4/DPcWbZiXIPM/s33/linkedin.jpg'/></a></li>";


echo "<li><a class='tips' data-title='Twitter'                 href='http://twitter.com/share?url=".$site_url."' rel='nofollow' target='_blank'><img src='https://lh6.googleusercontent.com/-LWZCI166jr4/UhRorVB4MdI/AAAAAAAAChI/V3ir2xRth7U/s33/twitter.jpg'/></a></li>";


echo "<li><a class='tips' data-title='Google+'        href='https://plus.google.com/u/0/share?url=".$site_url."' rel='nofollow' target='_blank'><img src='https://lh6.googleusercontent.com/-GnP5yhTBMQU/UhRop_RqX7I/AAAAAAAACg8/z1oV5uQeGdk/s33/gplus.jpg'/></a></li>";
?>

</ul>





这段代码运行正常,但我的问题是,它只会将指定页面的链接共享给用户,并且不会共享任何图像和内容。





帮我做这个。





在此先感谢,

Sanjita



This code run correctly but what is my problem is, it will share only the link of the specified page to the user and does not share any images and the content.


Help me to do this one.


Thanks in advance,
Sanjita

推荐答案

site_url = http://
site_url = "http://" .


_SERVER [' HTTP_HOST']。
_SERVER['HTTP_HOST'] .


_SERVER [' REQUEST_URI'];

echo < li>< a class ='tips'data-title ='Facebook'href ='http://www.facebook.com/sharer.php?u =
_SERVER['REQUEST_URI']; echo "<li><a class='tips' data-title='Facebook' href='http://www.facebook.com/sharer.php?u= ".


这篇关于如何使用PHP将图像和内容标题分享到社交媒体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆