我得到了來自Facebook的JSON響應。如何檢索$id
& $post_id
的值?如何閱讀php的JSON響應
$response = json_decode (file_get_contents($graph_url));
$id = $response.id;
$post_id = $response.post_id;
print_r($response);
print_r($id);
print_r($post_id);
輸出:
stdClass Object ([id] => 232160686920835 [post_id] => 231794566957447_232160693587501)
的$id
& $post_id
... 無輸出...
你錯誤PHP的JavaScript;)。只需使用'$ id = $ response-> id' – Broncha 2013-02-17 17:53:22