我在服务器上的一个单独文件中拥有此JSON数组:
data = '[{"name" : "AAA", "year" : "1999", "plot" : "BBB", "run" : "194 min", "rated" : "PG-13", "score" : "7.7/10", "source" : "DDD", "id" : "000000"}]';
您将如何使用PHP获得数组中的“名称”(AAA)?
对不起,如果我错过了什么,就从PHP和JSON开始。
在PHP中,您可以name
从json响应获取:
// your json response
$string = '[{"name" : "AAA", "year" : "1999", "plot" : "BBB", "run" : "194 min", "rated" : "PG-13", "score" : "7.7/10", "source" : "DDD", "id" : "000000"}]';
$encoded = json_decode($string,TRUE);
print_r($encoded); // complete array
echo $encoded[0]['name']; // print AAA
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句