Php Facebook共享按钮参数don';行不通
我想添加一个facebook共享按钮,但弹出窗口没有显示正确的参数。这是我的代码:Php Facebook共享按钮参数don';行不通,php,facebook,facebook-sharer,Php,Facebook,Facebook Sharer,我想添加一个facebook共享按钮,但弹出窗口没有显示正确的参数。这是我的代码: <?php $title=urlencode('Title of the iFrame Tab'); $url=urlencode('http://my-domain/index.php?langue=eng&table_pub=publication_eng&id=22&rub=publication'); $summary=urlencode('Custom message h
<?php
$title=urlencode('Title of the iFrame Tab');
$url=urlencode('http://my-domain/index.php?langue=eng&table_pub=publication_eng&id=22&rub=publication');
$summary=urlencode('Custom message here');
$image=urlencode('http://my-domain/img.png');
?>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&p[summary]=<?php echo $summary;?>&p[url]=<?php echo $url; ?>&p[images][0]=<?php echo $image;?>','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">Share</a>
但这段代码总是显示这样一个弹出窗口:
Facebook不再支持sharer.php中的自定义参数
使用facebook javascropt sdk 您的共享按钮
<a href="yoururl" data-image="yourimage" data-title="title" data-desc="Some description" class="fbshare">FBShare</a>
我遵循这篇文章,它帮助我找到了合适的解决方案:尝试了,但没有成功。单击链接只会打开href url。没有facebook互动
<a href="yoururl" data-image="yourimage" data-title="title" data-desc="Some description" class="fbshare">FBShare</a>
$('.fbshare').click(function(){
elem = $(this);
postToFeed(elem.data('title'), elem.data('desc'),
elem.prop('href'),
elem.data('image'));
return false;
});