$postURL = $URL;
$json = file_get_contents($postURL);
$obj = json_decode($json);
print_r ($json);
print_r
给我一个空白,echo $obj->{'name'}
我怀疑我可能不正确地处理结果。我需要帮助 - 只需要能够使用$obj->{'name'}
从对象中获取单个键/值。
GET d41d8cd98f00b204e9800998ecf8427e Mon, 16 Dec 2013 09:47:07 GMT
/targets/32feaf056b8c46e4a6f5500b6289cf59{"target_record":
{"target_id":"32feaf056b8c46e4a6f5500b6289cf59","name":"Francesca
Grace","width":300.0,"active_flag":true,"tracking_rating":5,"reco_rating":""},
"status":"success","result_code":"Success",
"transaction_id":"d5f6be0a66af4e3d84d00ad4cb1ac2e3"}
答案 0 :(得分:1)
这是json与google率系统的一个例子:
$data = file_get_contents('http://rate-exchange.appspot.com/currency?from=GBP&to=EUR');
$resultat = json_decode($data, true);
echo $resultat["rate"];
答案 1 :(得分:0)
$postURL = $URL;
$json = file_get_contents($postURL);
$obj = json_decode($json);
print_r ($obj);