0

sharer.php在 facebook 页面选项卡应用程序上运行了以下 facebook 脚本。在我尝试使用添加货币符号之前,共享效果很好

htmlentities(money_format("%10.2n", $numrows[price]))

有趣的是,这个分享选项和货币符号一样在页面上,并且货币符号显示正确

这是完整的代码。

<?php
    $title=urlencode(''.$numrows['title'].' | '. htmlentities(money_format("%10.2n", $numrows[price])).' '.$currency_code.'');
    $url=urlencode(''.$token.'');
    $summary=urlencode(''.$numrows['description'].'');
    $image=urlencode(''.$numrows['img1'].'');
?>
<a id="button" 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=550,height=400');" target="_parent" href="javascript: void(0)">
<input type='submit' class='btn' title='Share This Item With Friends' value='Share On Facebook'></form>  
</a>  

在此先感谢,这已经让我发疯了好几天了

4

1 回答 1

0

显示符号是一回事,但将其添加到查询字符串中则完全不同。我不确定调用的结果是什么,htmlentities(money_format(...))因为我不是 php 程序员,但我的猜测是您需要对其进行 url 编码才能将其添加到查询字符串中,就像使用 '=', '?' 和 '&'。

话虽如此,您应该知道 facebook 共享已被弃用且不再受支持,您可以在文档中阅读:

Share 按钮已被弃用,取而代之的是 Like 按钮,并且将不再受支持。请尽可能使用“赞”按钮为您的应用带来最大流量。

(参考:http: //developers.facebook.com/docs/share/

和:

旧的“分享”按钮怎么了?

当我们启动“赞”按钮时,我们弃用了“分享”按钮,因为“赞”按钮允许用户一键连接,并允许他们查看他们的哪些朋友已经连接,从而提高了点击率。

(参考:http: //developers.facebook.com/docs/reference/plugins/like/

您应该切换点赞按钮,但您也需要对内容进行 url 编码。

于 2012-05-24T21:43:49.850 回答