gpt4 book ai didi

php - 如何在 Facebook Sharer 中显示图像?

转载 作者:搜寻专家 更新时间:2023-10-31 20:43:26 27 4
gpt4 key购买 nike

我正在使用代码显示弹出式 Facebook 共享器,但问题是图像未显示。

<?php
$title="My Wedding Lookbook! | BridalBook.ph 3rd Anniversary Promo";
$url="http://www.bridalbook.ph/promos/bridalbook-3rd-year-anniv-promo/?preview=1";
$summary="I just created my dream wedding lookbook! Getting married? Make your own on BridalBook.ph!";
$image="http://pagsanjanpalmresort.com/moodboards/111.jpg";
?>

<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');">
Share on Facebook.
</a>

出了什么问题?

最佳答案

除image url和Share url之外的所有其他参数都需要进行urlencoded。

示例 Javascript 实现如下

    imageUrl = 'http://pagsanjanpalmresort.com/moodboards/111.jpg';
shareTitle = 'My%20Wedding%20Lookbook!%20%7C%20BridalBook.ph%203rd%20Anniversary%20Promo';
desc = 'I%20just%20created%20my%20dream%20wedding%20lookbook!%20Getting%20married%3F%20Make%20your%20own%20on%20BridalBook.ph!';
url = 'http://www.bridalbook.ph/promos/bridalbook-3rd-year-anniv-promo/?preview=1';

window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + shareTitle + '&p[summary]=' + desc + '&p[url]=' + url + '&p[images][0]=' + imageUrl + '', 'sharer', 'toolbar=0,status=0,width=626,height=436');

关于php - 如何在 Facebook Sharer 中显示图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16929902/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com