我收到來自端點的API響應:如何從簡單的API響應中提取數據?
http://rest.sharethis.com/reach/getUrlInfo.php?url=「http://www.mydomain.com/」
{ "email" : { "inbound" : 47498,
"outbound" : "27459"
},
"facebook" : { "inbound" : 6311,
"outbound" : "2301"
},
"other" : { "inbound" : 2196,
"outbound" : "1456"
},
"sharethis" : { "inbound" : 16536,
"outbound" : "7746"
},
"total" : { "inbound" : 80399,
"outbound" : "40956"
},
"twitter" : { "inbound" : 4946,
"outbound" : "1298"
}
}
我怎樣才能獲得的「入出境+」的總和「總「變量像一個字符串像$總回聲在PHP中。
沒有問題,但是如果您無法找到如何使用PHP解析JSON以及如何訪問對象圖,那麼您不應該使用REST API,而應該首先掌握基本知識。 – Gordon 2011-04-07 08:43:01
好吧,我不得不開始學習一天,我不知道它是JSON。我仍然在學習PHP。 – Sam 2011-04-07 08:59:23
那麼,「開始學習」是好的,也許只是開始學習基礎知識吧) – Gordon 2011-04-07 09:04:27