V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jy04149886
V2EX  ›  PHP

关于解析 json 无法解析

  •  
  •   jy04149886 · 2014-11-10 19:47:31 +08:00 · 3100 次点击
    这是一个创建于 3673 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有一段json,用json_decode返回为null,请大神帮忙看一下
    代码:$url=$_GET["url"];
    $res = file_get_contents($url);
    $res = json_decode($res,ture);
    var_dump($res);

    json:{
    "currTime"
    :
    1415617116876, "result"
    :
    "1", "message"
    :
    "", "value"
    :
    {
    "UserID"
    :
    "6e858035-083d-48b5-b822-74738e0d9434", "UserName"
    :
    "杨阳", "MobilePhone"
    :
    "18611645681", "UserAccount"
    :
    "18611645681", "Province"
    :
    "北京", "City"
    :
    "丰台区", "Sex"
    :
    "1", "IDSID"
    :
    "584b7781-7519-4f8e-91fb-e898e504bb1f", "IdsName"
    :
    "智信通演示专用(V5.1)", "SeviceName"
    :
    "", "SeviceTel"
    :
    "18611645681", "customerFlag"
    :
    "000", "platformFlag"
    :
    "ZXT", "invitedCode"
    :
    "RWZ", "ModifyTime"
    :
    1415592178000, "product"
    :
    [{
    "SN": "18110515",
    "snPwd": "18110515",
    "IDC": "19110503937",
    "CarTypeCode": "V",
    "PlateNumber": "京N16Q96",
    "LastServiceTime": "2014-11-10",
    "MacAddress": "00:15:FF:F2:43:30",
    "CarSerialName": "上海大众",
    "SerialNumber": "110537",
    "CarSerialID": "69912AAD-5992-490C-A9AD-ACAF16D20D8F",
    "CarsModelID": "ae853982-3bce-4382-9296-fbc194ae6aaa",
    "CarModelName": "新POLO",
    "CarModelCode": "11",
    "RegTime": 1415168103000,
    "isSoundCard": 0,
    "ProductName": "Tmt0N-Y05A智信通汽车远程体检系统",
    "ProductCode": "F",
    "isNewCar": 0,
    "ModifyTime": 0,
    "ERPdata": null,
    "lastMileage": "5000.00",
    "InsureDate": "",
    "ProductId": "3b41064f-fc44-40c4-94b7-a27d10418f88",
    "OrderTime": "",
    "isClearCode": 1,
    "isVoltageAlarm": 0,
    "ProductModel": "C.Y.0005A",
    "ServiceTel": null,
    "isTTS": 0,
    "isAccSensor": 0,
    "engineNo": "",
    "VIN": "",
    "isGps": 0
    }, {
    "SN": "420003291",
    "snPwd": "278953",
    "IDC": "19420003291",
    "CarTypeCode": "K",
    "PlateNumber": "",
    "LastServiceTime": "2014-11-10",
    "MacAddress": "",
    "CarSerialName": "北京现代",
    "SerialNumber": "420003291",
    "CarSerialID": "6D96C7FB-0DE2-4588-AFF3-299015E7D09A",
    "CarsModelID": "04a20d34-6fe2-4af7-b46b-5caf8a2b65e7",
    "CarModelName": "名图",
    "CarModelCode": "13",
    "RegTime": 1415587989000,
    "isSoundCard": 0,
    "ProductName": "Tmt0N-Y05D1W低脉冲 车联网系统V1.0",
    "ProductCode": "W",
    "isNewCar": 0,
    "ModifyTime": 0,
    "ERPdata": null,
    "lastMileage": "",
    "InsureDate": "",
    "ProductId": "e01a1bef-37cf-4b73-920d-ab667d7aac41",
    "OrderTime": "",
    "isClearCode": 0,
    "isVoltageAlarm": 0,
    "ProductModel": "C.Y.0008E",
    "ServiceTel": null,
    "isTTS": 0,
    "isAccSensor": 0,
    "engineNo": "",
    "VIN": "",
    "isGps": 0
    }, {
    "SN": "40007499",
    "snPwd": "585830",
    "IDC": "19040007499",
    "CarTypeCode": "V",
    "PlateNumber": "",
    "LastServiceTime": "2014-11-10",
    "MacAddress": "00:15:FF:F3:A8:46",
    "CarSerialName": "一汽-大众",
    "SerialNumber": "040007499",
    "CarSerialID": "15055F3D-57FD-4C87-A8AA-2173AF07C57A",
    "CarsModelID": "8766dd1f-26d4-43ff-956a-68ee49ec92e2",
    "CarModelName": "高尔夫6",
    "CarModelCode": "8",
    "RegTime": 1415591118000,
    "isSoundCard": 1,
    "ProductName": "Tmt0N-Y05A11WS智信通汽车远程体检系统",
    "ProductCode": "X",
    "isNewCar": 0,
    "ModifyTime": 0,
    "ERPdata": null,
    "lastMileage": "",
    "InsureDate": "",
    "ProductId": "2994df09-45fe-45a9-8e6e-cd374a129b6b",
    "OrderTime": "",
    "isClearCode": 1,
    "isVoltageAlarm": 0,
    "ProductModel": "C.Y.0005D",
    "ServiceTel": null,
    "isTTS": 0,
    "isAccSensor": 0,
    "engineNo": "",
    "VIN": "",
    "isGps": 0
    }]
    }
    }
    4 条回复    2014-11-10 21:34:26 +08:00
    kofj
        1
    kofj  
       2014-11-10 20:51:48 +08:00
    jy04149886
        2
    jy04149886  
    OP
       2014-11-10 21:05:21 +08:00
    返回空值、、、、貌似加一个mb_convert_encoding也许好用了。。。
    tinyhill
        3
    tinyhill  
       2014-11-10 21:10:48 +08:00
    字符串是不是 UTF-8 编码?PHP 要求字符串必须为 UTF-8 编码的,GBK 会反馈 null
    jy04149886
        4
    jy04149886  
    OP
       2014-11-10 21:34:26 +08:00
    谢啦,我用的转换函数,貌似可以了。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2585 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 06:06 · PVG 14:06 · LAX 22:06 · JFK 01:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.