1、
<head>
<!-- Facebook Open Graph -->
<meta property="og:title" content="名称?>"/>
<meta property="og:description" content="摘要?>"/>
<meta property="og:url" content="<?php echo $_SERVER['REQUEST_URI'];(网址)?>"/>
<meta property="og:image" content="图片"/>
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="网站名称"/>
</head>
2、在body里面加入以下代码
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4";
// js.src = "//connect.facebook.net/zh_CN/sdk.js#xfbml=1&version=v2.4";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- Your share button code -->
<!-- data-href="https://developers.facebook.com/docs/plugins/"-->
<div class="fb-share-button" data-layout="button_count"></div>
<script>
$(function(){
$(".fb-share-button").attr("data-href",this.location.href);
});
</script>