0
URL的输出应该是json格式。我目前有:从URL抓取数据Php
<?php
$url = 'http://ffapi.fanfeedr.com/basic/api/leagues?api_key=thekeyvalue';
$content = file_get_contents($url);
$json = json_decode($content, true);
foreach($items as $item) {
print $item['id']."<br>".$item['name'];
}
它给我这个错误:
Invalid argument supplied for foreach()
我在做什么错?任何人都可以告诉我?
你不觉得你忘了告诉我们一个变量 ? – 2012-02-06 23:52:58
变量'$ items'在哪里被声明?! – 2012-02-06 23:54:17