dongtongjian3127 2011-03-04 12:31
浏览 137

Json数组包含图像URL。 如何显示该图像?

I have a decoded set of json response data so when I do this:

$response = json_decode($data);

echo $response[img_url];

And open the .php file in a browser I get the link. How do I take the next step so that I can display an image with that file instead of the link?

Searches for trying to take json array data and displaying it in html points me to how to take list items and put them in html tables. If that is the extent of what I can do with arrays and html, do I need another step between going from array to html? or do I need to not put the $response into an array and put it into something else?

  • 写回答

2条回答 默认 最新

  • dqudtskm49788 2011-03-04 12:35
    关注

    Trying echoing the URL in an image tag:

    echo '<img src="'.$response['img_url'].'" />';
    

    Also, let me take this opportunity to highlight one of the benefits of single quotes: You don't have to escape double-quoted HTML attribute values!

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度