<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo 'http://domainame.com/'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];?>&layout=button_count&show_faces=false&width=120&action=recommend&font=verdana&colorscheme=light&height=21"
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>
但如果我在 http://domainame.com/?bla它打印http://domainame.com//index.php?bla
如果我可以发送 this.href 但我不知道如何在此处插入 js,
帮助?
在您的帮助下我们开始工作:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo str_replace("index.php","",'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']); ?>&layout=button_count&show_faces=true&width=150&action=recommend&font&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>
可以好转吗?
最佳答案
尝试使用以下作为 href
的值:
<?php echo rawurlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>
关于php - 如何发送 facebook 按钮当前 href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5532250/