簡體   English   中英

PHP / HTML在div中回顯變量

[英]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&amp;href="',$link,'"&amp;send=true&amp;layout=button_count&amp;width=50&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=trebuchet+ms&amp;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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM