我想使用 json 解码来获取这些数据。请帮忙..
到目前为止,我想出了这个脚本,但我无法在操作下获取倒数第二个和最后一个“名称”和“链接”。请帮忙..
foreach($json['data'] as $post)
{
$name1 = $post['actions']['name'];
$name2 = $post['actions']['name']['name'];
$name3 = $post['actions']['name']['name']['name'];
但这不起作用请帮助我想从以下示例中获取所有名称和链接数据,它是来自 facebook graph api 的片段。
{ "data": [ { "actions": [ { "name": "Comment", "link": "http://www.facebook.com/xxxxxidxxxx/posts/xxxxidxxxxxx" }, { "name": "Like", "link": "http://www.facebook.com/xxxxxidxxxxxx/posts/xxxxidxxxxxxx" } { "name": "Comment", "link": "http://www.facebook.com/xxxxxidxxxx/posts/xxxxidxxxxxx" }, { "name": "Like", "link": "http://www.facebook.com/xxxxxidxxxxxx/posts/xxxxidxxxxxxx" } { "name": "Comment", "link": "http://www.facebook.com/xxxxxidxxxx/posts/xxxxidxxxxxx" }, { "name": "Like", "link": "http://www.facebook.com/xxxxxidxxxxxx/posts/xxxxidxxxxxxx" } ],