简体   繁体   English

我如何使用php_decode和url在php中获取json对象的结果

[英]How can i get json object results in php using php_decode and url

below is my json object result of google api now i want to get url of cover from it which is parameter 'thumbnail' in below json object,but i dont know how can i retrive it can anyone here help me out? 下面是我的谷歌api的json对象结果,现在我想从它获取封面的url,这是json对象下面的参数“ thumbnail”,但是我不知道我该如何找回它,任何人都可以在这里帮助我吗?

{
         "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
           }
          }
         ]
        }

You could do like this.. 你可以这样

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

Demo 演示版

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM