从特定的ARRAY获取数据

时间:2014-10-31 07:02:05

标签: php arrays

这里$ get是:

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 ['title']或$ get [0] ['title'] =“不了解操作系统”以及格式?

1 个答案:

答案 0 :(得分:1)

使用json_decode

<?php

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

?>