猿问

一个关于PHP数组和JSON的小问题

如何在一个PHP里把{"song":[{"title":"ht1","picture":"ht2","artist":"ht3","url":"ht4"}]}转换成{"title":"ht1","picture":"ht2","artist":"ht3","url":"ht4"}并显示出来,求一段可运行的完整代码,感激不尽!
慕粉1411173927
浏览 1219回答 3
3回答

仙士可

$str = json_decode('{"song":[{"title":"ht1","picture":"ht2","artist":"ht3","url":"ht4"}]}',true);echo json_encode($str['song']);

田心枫

你要转换的那个不就在你要的json里面吗  直接取出来不就行了?
随时随地看视频慕课网APP
我要回答