dqk94069 2013-04-27 12:55
浏览 40
已采纳

将JSON导入CodeIgniter

How do I import and use JSON in CodeIgniter? For example, the codesnippet below is written in Python and converts Reddit's front page into JSON and prints the keys:

reddit_front = r"""{"kind": "Listing", "data": {"modhash": "", "children": ...  """

import json
j = json.loads(reddit_front)
print j.keys()
  • 写回答

1条回答 默认 最新

  • duangai1941 2013-04-27 13:02
    关注

    If you have a json string ready you can use below function in php to read json string.

    $result is the json string for example
    
    $res = json_decode($result,true);
    

    Now use foreach to loop through the $res to print the values

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 visionmaster启动失败,提示为“机器不满足授权而被禁用”
  • ¥50 用logisim设计16位单时钟周期cpu
  • ¥15 IDEA中圈复杂度如何具体设置
  • ¥50 labview采集不了数据
  • ¥15 请上面代码做什么处理或什么混淆
  • ¥15 英雄联盟自定义房间置顶
  • ¥15 W5500网线插上无反应
  • ¥15 如何用字典的Key,显示在WPF的xaml中
  • ¥15 weautomate读取Excel表格信息然后填写到网页一直报错,如何解决?
  • ¥15 C#如何在Webview2中获取网页验证码