데이터 -> 이름을 어떻게 표시합니까? Facebook JSON 배열
{
"data": [
{
"name": "Aasdada",
"category": "asdasd",
"id": "2342342342",
"created_time": "2012-11-28T03:56:00+0000"
}
],
"paging": {
"next": "https://graph.facebook.com/&limit=5000&offset=5000&__after_id=12312"
}
}
나는이 시도하지만 아무것도 출력되지 않고 :
$user = json_decode(file_get_contents($graph_url), true);
echo("Hello " . $user->data->name);
//also tried this
echo("Hello " . $user[data]); //did not echo anything
echo("Hello " . $user->data[0]->name); //did not echo anything
$user->data[0]['name'] //still no luck
어떤 문제가 될 수 있을까? 어쨌든 내 코드는 배열에없는 데이터와 작동합니다.
사용자가 페이지를 좋아하는지 여부를 간단하게하려고합니다. 데이터에 내용이 없으면 사용자가 페이지를 좋아하지 않았 음을 의미합니다. 데이터가있는 경우 사용자가 페이지를 좋아했다는 의미입니다. --edit--
그래서이 밖으로 시도 :
array(2) { ["data"]=> array(1) { [0]=> array(4) { ["name"]=> string(28) "Aasdda" ["category"]=> string(5) "asdad" ["id"]=> string(15) "3123123123" ["created_time"]=> string(24) "2012-11-28T03:56:00+0000" } } ["paging"]=> array(1) { ["next"]=> string(245) "https://graph.facebook.com/100023123123" } }
이 작업 ... :) 감사합니다. – madziikoy