[英]PHP/HTML echo a variable in a div
我有一個div效果很好
<div id="fb-root"></div>
<fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font="">
</fb:like>
如果嘗試使用回顯,則執行此操作時不會獲得$ link的值。
echo '<div id="fb-root"></div>
<fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font="">
</fb:like>';
同樣,這也是。 我無法獲得$ link。
echo '<iframe src="http://www.facebook.com/plugins/like.php?app_id=208015255907895&href="',$link,'"&send=true&layout=button_count&width=50&show_faces=true&action=like&colorscheme=light&font=trebuchet+ms&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:21px;" allowTransparency="true"></iframe> '
有什么幫助嗎?
您不能在echo
使用<?php ... ?>
。 嘗試:
echo '<div id="fb-root"></div><fb:like href="', $link, '" send="true" width="450" show_faces="true" font=""></fb:like>';
echo '<div id="fb-root"></div><fb:like href="'.$link.'" send="true" width="450" show_faces="true" font=""></fb:like>';
你不能添加<?php ?>
支架到您的echo
您搞砸了“”和一個新的php標簽
echo '<div id="fb-root"></div>
<fb:like href="'. $link .'" send="true" width="450" show_faces="true" font="">
</fb:like>';
嘗試這個:
echo '<div id="fb-root"></div>
<fb:like href="'.$link.'" send="true" width="450" show_faces="true" font="">
</fb:like>';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.