PHP JSON format how to deal with the array of?

Source: Internet
Author: User
Tags php json
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


Reply to discussion (solution)

$arr = Json_decode ($json, true);

$arr = Json_decode ($json, true);

Oh, no. You are. Try copying the JSON above

$str = ' {' 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 "} '; $json = Json_decode ($str, True); Var_dump ($json);

$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);p rint_r ($a);
Array ([MSG] = OK [Rela_opera] = 4 [bimg] = Http://v9.pfs.56img.com/images/22/6/justin0842i56olo56i5  6.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] = A Rray ([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.f Lv.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)
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.