【发布时间】:2011-07-28 18:48:03
【问题描述】:
<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>
能好起来吗?
【问题讨论】:
-
我可以内联吗?或者我将不得不在 $(document).ready 上这样做?
-
可以内联,贴个答案就行了。
标签: php javascript facebook href