dtp0760 2015-01-01 14:16
浏览 52
已采纳

Angellist api不会在foreach循环中返回数据

I grabbed the data with the following code:

$angellist = file_get_contents('https://api.angel.co/1/startups/6702/jobs');

When i print $angellist i get the data returned on my screen. So everything is fine until the next step.

When i use a foreach loop and i print out $list, nothing shows. What am i missing?

        foreach($angellist as $list):

            pr($list);

            endforeach; 

If you need more information, I am happy to oblige.

  • 写回答

1条回答 默认 最新

  • drsrq26482 2015-01-01 14:34
    关注

    Decode it using JSON to convert it into array and use it in foreach loop.Use the code below

    <?php
    $url = file_get_contents('https://api.angel.co/1/startups/6702/jobs');
    $angellist = json_decode($url,true);
     foreach($angellist as $list):
    
                pr($list);
    
                endforeach; 
    

    Hope this helps you

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

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计