Php 如何在facebook评论中使用当前URL作为Href?

Php 如何在facebook评论中使用当前URL作为Href?,php,facebook,Php,Facebook,我使用的是facebook评论插件,我相信我使用它时没有设置href,它会自动将当前url用作href,但它停止工作,说我必须设置href 如何将HREF设置为当前URL,以便在每个页面上获得不同的评论 <fb:comments href="" num_posts="2" width="500" style="padding-top: 20px; margin-top: 20px; border-top: 1px dotted grey;"></fb:comments>

我使用的是facebook评论插件,我相信我使用它时没有设置href,它会自动将当前url用作href,但它停止工作,说我必须设置href

如何将HREF设置为当前URL,以便在每个页面上获得不同的评论

<fb:comments href="" num_posts="2" width="500" style="padding-top: 20px; margin-top: 20px; border-top: 1px dotted grey;"></fb:comments>


谢谢

如果您正在使用wordpress(我猜),您应该在
fb:comments
中输入

<fb:comments href="<?php the_permalink(); ?>" num_posts="2" width="500" style="padding-top: 20px; margin-top: 20px; border-top: 1px dotted grey;"></fb:comments>
所以

$currentUrl=$protocol'://'$主持人$脚本“?”$参数;
//或
$currentUrl=$protocol.'://'$主持人$uri;

如果您正在使用wordpress(我猜),您应该在
fb:comments
中输入

<fb:comments href="<?php the_permalink(); ?>" num_posts="2" width="500" style="padding-top: 20px; margin-top: 20px; border-top: 1px dotted grey;"></fb:comments>
所以

$currentUrl=$protocol'://'$主持人$脚本“?”$参数;
//或
$currentUrl=$protocol.'://'$主持人$uri;
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
// or
$currentUrl = $protocol . '://' . $host . $uri;

<fb:comments href="<?php echo $currentUrl; ?>" num_posts="2" width="500" style="padding-top: 20px; margin-top: 20px; border-top: 1px dotted grey;"></fb:comments>