2014-10-31 59 views
1

這裏$得到得到的數據是:從特定陣列

Array ([0] => 
{ 
    "display_id": "x28urqr", 
    "upload_date": null, 
    "stitle": "Not understand anything about Operating Systems", 
    "extractor": "dailymotion", 
    "height": 1080, "_filename": "Not understand anything about Operating Systems-x28urqr.mp4", 
    "uploader": "ComiKaz", 
    "format_id": "hd180", 
    "id": "x28urqr", 
    "subtitles": null, 
    "view_count": 911, 
    "playlist": null, "title": "http://www.dailymotion.com/cdn/H264-1920x1080/video/x28urqr.mp4?auth=1414911272-2562-4ueteft7-68e156e4a0b867bae4466a2d4c67a65a", 
    "extractor_key": "Dailymotion", 
    "format": "hd180 - 1920x1080", 
    "playlist_index": null, 
    "width": 1920, 
    "ext": "mp4", 
    "webpage_url": "http://www.dailymotion.com/video/x28urqr_not-understand-anything-about-operating-systems_fun", 
    "formats": [ 
     { 
     "format": "ld - 320x240", 
     "url": "http://www.dailymotion.com/cdn/H264-320x240/video/x28urqr.mp4?auth=1414911272-2562-6s9b7my1-c6833445fdd93d4c8627fc13e4877028", 
     "height": 240, 
     "width": 320, 
     "ext": "mp4", 
     "format_id": "ld" 
     }, { 
     "format": "standard - 512x384", 
     "url": "http://www.dailymotion.com/cdn/H264-512x384/video/x28urqr.mp4?auth=1414911272-2562-72lc7499-49cefabcafb7fd89baed1fa090e3dc8b", 
     "height": 384, "width": 512, "ext": "mp4", "format_id": "standard" 
     }, { 
     "format": "hq - 848x480", 
     "url": "http://www.dailymotion.com/cdn/H264-848x480/video/x28urqr.mp4?auth=1414911272-2562-uh9fig2o-2eb95c2c3e648c4d1b4a36a21b640349", 
     "height": 480, 
     "width": 848, 
     "ext": "mp4", 
     "format_id": "hq" 
     }, { 
     "format": "hd - 1280x720", 
     "url": "http://www.dailymotion.com/cdn/H264-1280x720/video/x28urqr.mp4?auth=1414911272-2562-bkp4ien9-f76955f61afb4900baaeeb8dd2521f38", 
     "height": 720, 
     "width": 1280, 
     "ext": "mp4", 
     "format_id": "hd" 
     }, { 
     "format": "hd180 - 1920x1080", 
     "url": "http://www.dailymotion.com/cdn/H264-1920x1080/video/x28urqr.mp4?auth=1414911272-2562-4ueteft7-68e156e4a0b867bae4466a2d4c67a65a", 
     "height": 1080, 
     "width": 1920, 
     "ext": "mp4", "format_id": "hd180"} 
    ], 
    "fulltitle": "Not understand anything about Operating Systems", 
    "age_limit": 0, 
    "thumbnail": "http://s1.dmcdn.net/Hmp3z.jpg", 
    "webpage_url_basename": "x28urqr_not-understand-anything-about-operating-systems_fun" 
}) 

從上面的陣列,如何讓我的東西的樣子,$ GET [ '標題']或$拿到[0] [」標題'] =「不理解操作系統的任何內容」以及格式?

+0

啊這是JSON – Jaki 2014-10-31 07:08:12

+0

嘗試'$拿到[0] - > title' – UnLoCo 2014-10-31 07:13:37

+0

$ GET [0] - >標題似乎不工作。 「解析錯誤:語法錯誤,意外'$ get'(T_VARIABLE)」 – Jaki 2014-10-31 07:22:50

回答

1

使用json_decode

<?php 

    $result = json_decode($get[0], true); 
    echo $result['title']; 

?> 
+0

是的,這是工作....謝謝UnLoCo – Jaki 2014-10-31 07:35:16

+0

請檢查數組代碼中的「格式」部分,這是部分部分。如何從那裏獲取? – Jaki 2014-10-31 07:38:09

+0

它基本上是一樣的,但它是一個數組而不是一個字符串,所以試試'$ result ['formats'] ['format']或者$ result ['formats'] ['url']等等..' – UnLoCo 2014-10-31 07:41:43