在 facebook 的 share.php 上传递标题、网址和图片
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24322221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Passing title, url and image on share.php of facebook
提问by user3739733
I want to share title , image and description on facebook without javascript just by passing these to share.php of facebook. I got some code on this site in question Open source alternative to AddThis AddToAny, ShareThis etcfor Social Bookmarking
我想通过将这些传递给 facebook 的 share.php 来在没有 javascript 的情况下在 facebook 上共享标题、图像和描述。我在这个网站上得到了一些有问题的代码开源替代 AddThis AddToAny、ShareThis 等社交书签
and I have read the question how to pass custom parameter in facebook sharer link
我已经阅读了如何在 facebook 共享者链接中传递自定义参数的问题
Now I want to combine both questions. Can I pass Image, title and description simply in the facebook share.php url
现在我想把这两个问题结合起来。我可以简单地在 facebook share.php url 中传递图像、标题和描述吗
like:
喜欢:
<a class="scmFacebook" href='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;?>'>Facebook</a>
OR If I am wrong then please show me the right destination.
或者如果我错了,请告诉我正确的目的地。
回答by Sahil Mittal
According to the facebook developers (bug):
根据 facebook 开发人员(错误):
The sharer will no longer accept custom parameters and facebook will pull the information that is being displayed in the preview the same way that it would appear on facebook as a post from the url OG meta tags.
共享者将不再接受自定义参数,并且 facebook 将提取在预览中显示的信息,就像它在 facebook 上显示为来自 url OG 元标记的帖子一样。
Either you use the Share Button- requires Javascript SDK
Or, use the latest Share Dialog - requires just an app id. It has a direct url direction method for invoking the share dialog:
https://www.facebook.com/dialog/share? app_id={app-id} &display=popup &href={link-to-share} &redirect_uri={redirect-uri}