PHP JSON format how to deal with the array of?
This post was last edited by kj8629 on 2014-11-12 17:24:56
Jsonp_callback ({"MSG": "OK", "Rela_opera": -4, "bimg": "http://v9.pfs.56img.com/images/22/6/ Justin0842i56olo56i56.com_sc_141525800944hd_b.jpg "," vid ":" 129515958 "," opera_id ": -4," Subject ":" Dig Map "Elevator", "status ":" 1 "," duration ":" 146001 "," CPM ": 1," tags ":" Dig map,,,, "," df ": [{" url ":" Http://f8.r.56.com/f8.c178.56.com/flvdownload /21/4/sc_141525800944hd_qqvga.mp4?v=1&t=qo1wwemf4mtmbotihxanva&r=14513&e=1415869829&tt=146 &sz=1701822&vid=129515958 "," type ":" QQVGA "},{" url ":" Http://f8.r.56.com/f8.c196.56.com/flvdownload/19/0/ sc_141525800944hd.flv.mp4?v=1&t=uikhlaf7oyfyohqtt5q6yg&r=14513&e=1415869829&tt=146&sz= 5628144&vid=129515958 "," type ":" QVGA "},{" url ":" Http://f8.r.56.com/f8.c178.56.com/flvdownload/28/4/sc_ 141525800944hd_clear.flv.mp4?v=1&t=_vatplkpnqnkrdu-75v9iw&r=14513&e=1415869829&tt=145&sz= 10229011&vid=129515958 "," type ":" VGA "},{" url ":" Http://f8.r.56.com/f8.c177.56.com/flvdownload/17/11/sc_ 141525800944hd_super.flv.mp4?v=1&t=dagxouspchpml5yv3iekfa&r=14513&e=1415869829&tt=145&sz=20032192&vid=129515958 "," type ":" WVGA "}]," CID ":" 4 " , "user_id": "justin0842"});
----------------------------
The above is the received data format. How to deal with the array.??
Thank you
------to solve the idea----------------------
$s = ' jsonp_callback ({"MSG": "OK", "Rela_opera": -4, "bimg": "http://v9.pfs.56img.com/images/22/6/ Justin0842i56olo56i56.com_sc_141525800944hd_b.jpg "," vid ":" 129515958 "," opera_id ": -4," Subject ":" Dig Map "Elevator", "status ":" 1 "," duration ":" 146001 "," CPM ": 1," tags ":" Dig map,,,, "," df ": [{" url ":" Http://f8.r.56.com/f8.c178.56.com/flvdownload /21/4/sc_141525800944hd_qqvga.mp4?v=1&t=qo1wwemf4mtmbotihxanva&r=14513&e=1415869829&tt=146 &sz=1701822&vid=129515958 "," type ":" QQVGA "},{" url ":" Http://f8.r.56.com/f8.c196.56.com/flvdownload/19/0/ sc_141525800944hd.flv.mp4?v=1&t=uikhlaf7oyfyohqtt5q6yg&r=14513&e=1415869829&tt=146&sz= 5628144&vid=129515958 "," type ":" QVGA "},{" url ":" Http://f8.r.56.com/f8.c178.56.com/flvdownload/28/4/sc_ 141525800944hd_clear.flv.mp4?v=1&t=_vatplkpnqnkrdu-75v9iw&r=14513&e=1415869829&tt=145&sz= 10229011&vid=129515958 "," type ":" VGA "},{" url ":" Http://f8.r.56.com/f8.c177.56.com/flvdownload/17/11/sc_ 141525800944hd_super.flv.mp4?v=1&t=dagxouspchpml5yv3iekfa&r=14513&e=1415869829&tt=145&sz=20032192&vid=129515958 "," type ":" WVGA "}]," CID ":" 4 "," user_id ":" justin0842 "});
$a = Json_decode (Preg_replace ('/.*\ ((. +) \). */', ' $ ', $s), 1);
Print_r ($a);
Array
(
[MSG] = OK
[Rela_opera] = 4
[Bimg] = http://v9.pfs.56img.com/images/22/6/justin0842i56olo56i56.com_sc_141525800944hd_b.jpg
[Vid] = 129515958
[OPERA_ID] = 4
[Subject] = "Dig map" elevator
[Status] = 1
[Duration] = 146001
[CPM] = 1
[tags] = dig map,,,,
[DF] = = Array
(
[0] = = Array
(
[url] = http://f8.r.56.com/f8.c178.56.com/flvdownload/21/4/sc_141525800944hd_qqvga.mp4?v=1&t= qo1wwemf4mtmbotihxanva&r=14513&e=1415869829&tt=146&sz=1701822&vid=129515958
[Type] = QQVGA
)
[1] = = Array
(
[url] = http://f8.r.56.com/f8.c196.56.com/flvdownload/19/0/sc_141525800944hd.flv.mp4?v=1&t= uikhlaf7oyfyohqtt5q6yg&r=14513&e=1415869829&tt=146&sz=5628144&vid=129515958
[Type] = QVGA
)
[2] = = Array
(
[url] = http://f8.r.56.com/f8.c178.56.com/flvdownload/28/4/sc_141525800944hd_clear.flv.mp4?v=1&t=_ vatplkpnqnkrdu-75v9iw&r=14513&e=1415869829&tt=145&sz=10229011&vid=129515958
[Type] = VGA
)
[3] = = Array
(
[url] = http://f8.r.56.com/f8.c177.56.com/flvdownload/17/11/sc_141525800944hd_super.flv.mp4?v=1&t= dagxouspchpml5yv3iekfa&r=14513&e=1415869829&tt=145&sz=20032192&vid=129515958
[Type] = WVGA
)
)
[CID] = 4
[USER_ID] = justin0842
)