Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Facebook共享按钮参数don';行不通_Php_Facebook_Facebook Sharer - Fatal编程技术网

Php Facebook共享按钮参数don';行不通

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

我想添加一个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 here');
$image=urlencode('http://my-domain/img.png');
?>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $title;?>&amp;p[summary]=<?php echo $summary;?>&amp;p[url]=<?php echo $url; ?>&amp;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;
    });