doujian3401 2011-07-27 11:32
浏览 59
已采纳

PHP / HTML在div中回显变量

I have a div which works fine

  <div id="fb-root"></div>
   <fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font=""> 
   </fb:like>

If I try to use an echo, I don't get the value of $link when I do this.

echo '<div id="fb-root"></div>
<fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font="">
</fb:like>';

likewise this one too. i cannot get the $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> '

Any help?

  • 写回答

4条回答 默认 最新

  • dongpaocuan7498 2011-07-27 11:34
    关注

    You can't use <?php ... ?> in an echo. Try:

    echo '<div id="fb-root"></div><fb:like href="', $link, '" send="true" width="450" show_faces="true" font=""></fb:like>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?