這就是我得到儘可能從進取景器URL(JSON編碼)的字符串:如何解碼這個JSON字符串?
{"updated":1265787927,"id":"http://www.google.com/reader/api/0/feed-finder?q\u003dhttp://itcapsule.blogspot.com/\u0026output\u003djson","title":"Feed results for \"http://itcapsule.blogspot.com/\"","self":[{"href":"http://www.google.com/reader/api/0/feed-finder?q\u003dhttp://itcapsule.blogspot.com/\u0026output\u003djson"}],"feed":[{"href":"http://itcapsule.blogspot.com/feeds/posts/default"}]}
如何使用json_decode我解碼()函數在PHP和獲得最後一個數組元素(「飼料」) ?我用下面的代碼,但沒有運氣
$json = file_get_contents("http://www.google.com/reader/api/0/feed-finder?q=http://itcapsule.blogspot.com/&output=json");
$ar = (array)(json_decode($json,true));
print_r $ar;
請幫忙試了一下..
道歉,如果我誤解,但你不想只是$ ar ['feed']? – jasonbar 2010-02-10 08:46:13
PHP中不需要類型轉換。 – 2010-02-10 09:34:15
@Jasonbar, 是的你是對的。我只需要「feed」值。 – Orion 2010-02-10 10:50:48