即使json_last_error返回0,JSON URL请求仍返回Null

时间:2015-06-10 12:39:50

标签: php json

所以,我正在使用file_get_contents(url)来返回一些JSON数据。 当我使用var_dump(json_decode($result, true));时,它始终返回NULL

我使用echo json_last_error();并返回0,表示没有错误。

我花了很多年时间试图找到解决问题的方法。 (这也是我第一次使用JSON)

这里可能出现什么问题?

这是我刚申请1项时的结果值(很长,所以我只会显示1)

{
  "Items": [
    {
      "Id": 1034,
      "Name": "Direzza DZ102",
      "TyreBrand": {
      "Id": 10,
      "Name": "Dunlop"
    },
      "ShortDescription": "An aggressively styled sports performance tyre that is guaranteed to deliver. With features such as advanced handling in wet and dry conditions, Hydrogrip braking technologies, reduced fuel consumption and noise reduction. The Direzza DZ102 is the sports performance tyre that won't     disappoint.",
      "Images": [
        {
          "Id": "0b2773b6-eb10-4eea-bd69-3061cf4e6778",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-images/19/0b2773b6-eb10-4eea-bd69-3061cf4e6778.png",
          "Type": "Manf Angle Large",
          "Caption": ""
        },
        {
          "Id": "ac474cc2-30ce-43df-9856-d0a1ad722acd",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-images/18/ac474cc2-30ce-43df-9856-d0a1ad722acd.png",
          "Type": "Manf Angle Main",
          "Caption": null
        },
        {
          "Id": "1a386318-a4ee-4c5e-a808-e9b3031eeb82",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-    images/17/1a386318-a4ee-4c5e-a808-e9b3031eeb82.png",
          "Type": "Manf Angle Thumb",
          "Caption": null
        }
      ],
      "PerformanceCategory": "Ultra High Performance"
    }
  ],
  "Page": 1,
  "PerPage": 1,
  "Total": 40
}

0 个答案:

没有答案