What if PHPjson is formatted as an array?

Source: Internet
Author: User
How to format PHPjson into an array? At last, this post was edited by jsonp_callback ({msg: OK, rela_opera:-4, bimg: v9.pfs. 56img. comimages226justin08 PHP json formatted into an array by kj8629 at 2014-11?

This post was last edited by kj8629 at 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 ":" [dashboard] Elevator "," status ":" 1 ", "duration": "146001", "cpm": 1, "tags": "dashboard,", "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 process it into an array. ??

Thank you.

------ Solution ----------------------
$ 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 ":" [dashboard] Elevator "," status ":" 1 ", "duration": "146001", "cpm": 1, "tags": "dashboard,", "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 ('/. * \ (. +) \). */', '$ 1', $ s), 1 );
Print_r ($ );
Array
(
[Msg] => OK
[Rela_opera] =>-4
Http://v9.pfs.56img.com/images/22/6/justin0842i56olo56i56.com_ SC _141525800944hd_ B .jpg [bimg] =>
[Vid] = & gt; 129515958
[Opera_id] =>-4
[Subject] => [dashboard] Elevator
[Status] => 1
[Duration] = & gt; 146001
[Cpm] => 1
[Tags] => dashboard mining ,,,,
[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
)

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.