轻松修改以显示图像而不是网址

时间:2012-06-18 11:58:59

标签: php

如何显示图片而不是网址?

echo "<b>Image: </b> http://graph.facebook.com/" . $posts['from']['id'] ."/picture?type=large</br>";

4 个答案:

答案 0 :(得分:1)

只需使用<img>标记并将src设置为您的网址:

echo "<b>Image: </b> <img src='http://graph.facebook.com/"
      . $posts['from']['id'] ."/picture?type=large'></br>";

答案 1 :(得分:0)

尝试:

echo "<b>Image: </b><img src='http://graph.facebook.com/" . $posts['from']['id'] ."/picture?type=large'/></br>";

答案 2 :(得分:0)

<img src="http://graph.facebook.com/".$posts['from']['id'] 
         ."/picture?type=large">

这将构建正确的标记。

答案 3 :(得分:0)

echo '<b>Image: </b> <img src="http://graph.facebook.com/' . $posts['from']['id'] . '/picture?type=large" /><br />';

或者,不使用串联:

<b>Image: </b> <img src="http://graph.facebook.com/<?php echo $posts['from']['id']; ?>/picture?type=large" /><br />

或使用短标签:

<b>Image: </b> <img src="http://graph.facebook.com/<?=$posts['from']['id']?>/picture?type=large" /><br />