我试图从以下JSON中提取[name]并将其打印在网页上。
JSON:
[uploads] => Array
(
[0] => Array
(
[id] => 153270
[name] => heartbt.wav
[basename] => heartbt
[ext] => wav
[size] => 37742
[mime] => audio/x-wav
[type] => audio
[field] => my_file
[md5hash] => 947aff5e7fc7f19caff9032125e42a12
[original_id] => 153270
[original_basename] => heartbt
[original_path] => /
[original_md5hash] => 947aff5e7fc7f19caff9032125e42a12
[from_batch_import] =>
[url] => http://tmp.tr.com.s3.amazonaws.com/153c5c701f4511e5876dcf9427be7270.wav
[ssl_url] => https://s3.amazonaws.com/tmp.tr.com/153c5c701f4511e5876dcf9427be7270.wav
[meta] => Array
(
[duration] => 3.42
[audio_bitrate] => 88200
[overall_bitrate] => 88311
[audio_samplerate] => 11025
[audio_channels] => 1
[audio_codec] => pcm
[encoder] =>
[beats_per_minute] =>
[album] =>
[year] =>
[genre] =>
[artist] =>
[comment] =>
[performer] =>
[lyrics] =>
[title] =>
[band] =>
[disc] =>
[track] =>
)
)
)
我的代码:
$array = json_decode($result, true);
print_r($array["result"]["name"][0]);
如果我使用以下内容它会显示完整的JSON输出,所以我知道它看到了JSON。
print_r(json_decode($result, true));
有什么想法吗?我在这里找到了关于json_decode的一切,但没有运气。
P.S。我是一个老perl程序员,所以这个json让我有点困惑......有人记得Matt的脚本档案吗? :)