我正在尝试从json_decode
输出中获取一些值。我有一个在授予访问权限后连接到 Tumblr API 的脚本。解码后我已经到了这一点object
stdClass
。我现在遇到的问题是试图只回显博客的“名称”和“关注者”数量。下面的示例有两个博客而不是一个。因此,在下面的示例中,博客名称是“blogone”和“blogtwo”。
{"meta":{"status":200,"msg":"OK"},"response":{"user":{"name":"blogone","likes":0,"following":0,"default_post_format":"html","blogs":[{"name":"blogone","url":"http:\/\/blogone.tumblr.com\/","followers":234,"primary":true,"title":"Untitled","description":"","admin":true,"updated":1354139573,"posts":0,"messages":0,"queue":0,"drafts":0,"share_likes":true,"ask":false,"tweet":"N","facebook":"N","facebook_opengraph_enabled":"N","type":"public"},{"name":"blogtwo","url":"http:\/\/blogtwo.tumblr.com\/","followers":0,"primary":false,"title":"dfgdfg","description":"","admin":true,"updated":0,"posts":0,"messages":0,"queue":0,"drafts":0,"share_likes":false,"ask":false,"tweet":"N","facebook":"N","facebook_opengraph_enabled":"N","type":"public"}]}}}
问题是我如何回应每个博客的博客“名称”和“关注者”计数。有时只有一个博客,有时可能有多个博客。
谢谢你。