2014-02-15 49 views
0

下面是我的json对象的谷歌API结果现在我想从它获取封面的url这是参数'缩略图'在下面的json对象,但我不知道我怎么可以回顾一下这里有人能帮我吗?我怎样才能得到json对象结果在php中使用php_decode和url

{ 
     "kind": "books#volumes", 
     "totalItems": 1, 
     "items": [ 
      { 
      "kind": "books#volume", 
      "id": "9VKCkifBlisC", 
      "etag": "hhhZjjV6arI", 
      "selfLink": "url", 
      "volumeInfo": { 
      "title": "Instructor's manual to accompany An introduction", 
      "authors": [ 
      "Jean-Paul Tremblay", 
      "P. G. Sorenson" 
      ], 
      "publishedDate": "1976", 
      "industryIdentifiers": [ 
      { 
       "type": "ISBN_10", 
       "identifier": "0070651515" 
      }, 
      { 
       "type": "ISBN_13", 
       "identifier": "9780070651517" 
      } 
      ], 
      "pageCount": 278, 
      "printType": "BOOK", 
      "categories": [ 
      "Computers" 
      ], 
      "averageRating": 5.0, 
      "ratingsCount": 1, 
      "contentVersion": "0.0.1.0.preview.0", 
      "imageLinks": { 
      "smallThumbnail": "url", 
      /*this is what i need*/ 
         "thumbnail": "url" 
      }, 
      "language": "en", 
      "previewLink": "url", 
      "infoLink": "url", 
      "canonicalVolumeLink": "url" 
      }, 
      "saleInfo": { 
      "country": "IN", 
      "saleability": "NOT_FOR_SALE", 
      "isEbook": false 
      }, 
      "accessInfo": { 
      "country": "IN", 
      "viewability": "NO_PAGES", 
      "embeddable": false, 
      "publicDomain": false, 
      "textToSpeechPermission": "ALLOWED", 
      "epub": { 
      "isAvailable": false 
      }, 
      "pdf": { 
      "isAvailable": false 
      }, 
      "webReaderLink": "url", 
      "accessViewStatus": "NONE", 
      "quoteSharingAllowed": false 
      } 
      } 
     ] 
     } 
+0

http://www.php.net/manual/en/function.json-decode.php – Leri

+2

解码的JSON使用'json_decode'数据,然后一次执行一个步骤并使用'var_dump'转储结果:'var_dump($ json)','var_dump($ json ['items'])','var_dump($ json ['items '] [0])'等。 – Gumbo

+0

并且下一次是RTFM。 :) – Leri

回答

0

你可以做这样的..

$arr = json_decode($json,true); 
echo $arr['items'][0]['volumeInfo']['imageLinks']['thumbnail']; 

Demo

+1

它的作品就像一个魅力 – BakerStreet221