我可以使用facebook api获得所需的数据,例如兴趣,电影等。其中包含以下格式。
Array
(
[data] => Array
(
[0] => Array
(
[category] => Movie
[name] => 3 Idiots Movie
[created_time] => 2012-05-11T13:22:34+0000
[id] => 441170255909978
)
[1] => Array
(
[category] => Movie
[name] => Harry Potter
[created_time] => 2011-04-11T05:44:14+0000
[id] => 156794164312
)
[2] => Array
(
[category] => Movie
[name] => Official Narnia: Voyage of the Dawn Treader
[created_time] => 2011-03-10T18:26:57+0000
[id] => 190647217857
)
[3] => Array
(
[category] => Movie general
[name] => Harry Porter
[created_time] => 2011-03-10T18:26:57+0000
[id] => 360697777345
)
如何获取仅提供电影和ID的详细信息,以便我可以存储在数据库中?
答案 0 :(得分:1)
您可以采用以下形式:
foreach (Array['data'] as $var)
{
$ID=$var['id'];
$Name=$var['name'];
}
注意:在Array['data']
中,Array将是您要保存此数据的变量的名称。