0

我可以使用 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 的详细信息以便我可以存储在数据库中?

4

1 回答 1

1

您可以执行以下形式的操作:

foreach (Array['data'] as $var)
{
     $ID=$var['id'];
     $Name=$var['name'];
}

注意:Array['data']中,Array 将是您保存此数据的变量的名称。

于 2013-07-24T09:52:48.803 回答