吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1002|回复: 2
收起左侧

[求助] PHP咋把json转换成数组

[复制链接]
安逸丫 发表于 2020-1-27 14:47
本帖最后由 安逸丫 于 2020-1-27 14:48 编辑

{"songs":[{"name":"四重罪孽","id":430053202,"pst":0,"t":0,"ar":[{"id":12077190,"name":"易世樊花","tns":[],"alias":[]},{"id":12025552,"name":"双笙","tns":[],"alias":[]},{"id":12084085,"name":"汉南蛮久","tns":[],"alias":[]}],"alia":[],"pop":100.0,"st":0,"rt":"","fee":0,"v":43,"crbt":null,"cf":"","al":{"id":34871558,"name":"易世樊花2016翻唱集合","picUrl":"https://p1.music.126.net/NbBSu6EjFWTX1yvTTF2Sjg==/17699938184287815.jpg","tns":[],"pic_str":"17699938184287815","pic":17699938184287815},"dt":233363,"h":{"br":320000,"fid":0,"size":9344566,"vd":-31900.0},"m":{"br":192000,"fid":0,"size":5606757,"vd":-29200.0},"l":{"br":128000,"fid":0,"size":3737853,"vd":-27700.0},"a":null,"cd":"1","no":22,"rtUrl":null,"ftype":0,"rtUrls":[],"djId":0,"copyright":2,"s_id":0,"mark":0,"originCoverType":0,"mv":0,"mst":9,"cp":0,"rtype":0,"rurl":null,"publishTime":1473741044348}],"privileges":[{"id":430053202,"fee":0,"payed":0,"st":0,"pl":320000,"dl":320000,"sp":7,"cp":1,"subp":1,"cs":false,"maxbr":320000,"fl":999000,"toast":false,"flag":0,"preSell":false}],"code":200}

各位大佬咋把上面的  “双笙” 和 “图片地址”
取出转换为PHP数组啊求助

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

琴似蓝调 发表于 2020-1-27 18:32
<?php
$res='{"songs":[{"name":"四重罪孽","id":430053202,"pst":0,"t":0,"ar":[{"id":12077190,"name":"易世樊花","tns":[],"alias":[]},{"id":12025552,"name":"双笙","tns":[],"alias":[]},{"id":12084085,"name":"汉南蛮久","tns":[],"alias":[]}],"alia":[],"pop":100.0,"st":0,"rt":"","fee":0,"v":43,"crbt":null,"cf":"","al":{"id":34871558,"name":"易世樊花2016翻唱集合","picUrl":"https://p1.music.126.net/NbBSu6EjFWTX1yvTTF2Sjg==/17699938184287815.jpg","tns":[],"pic_str":"17699938184287815","pic":17699938184287815},"dt":233363,"h":{"br":320000,"fid":0,"size":9344566,"vd":-31900.0},"m":{"br":192000,"fid":0,"size":5606757,"vd":-29200.0},"l":{"br":128000,"fid":0,"size":3737853,"vd":-27700.0},"a":null,"cd":"1","no":22,"rtUrl":null,"ftype":0,"rtUrls":[],"djId":0,"copyright":2,"s_id":0,"mark":0,"originCoverType":0,"mv":0,"mst":9,"cp":0,"rtype":0,"rurl":null,"publishTime":1473741044348}],"privileges":[{"id":430053202,"fee":0,"payed":0,"st":0,"pl":320000,"dl":320000,"sp":7,"cp":1,"subp":1,"cs":false,"maxbr":320000,"fl":999000,"toast":false,"flag":0,"preSell":false}],"code":200}';

$r=json_decode($res,true);
print_r($r['songs'][0][ar][1][name]);
print_r($r['songs'][0][al][picUrl]);
 楼主| 安逸丫 发表于 2020-1-29 00:06
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 20:31

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表