从服务请求中,我得到以下响应,我尝试使用json_decode
解析它,但它不起作用。我需要检查 ["body"]->enquiry->status
是否“打开”。任何人都可以告诉我如何解析这个回应?使用PHP解析JSON数组不起作用
array(5) {
["headers"] => array(5) {
["server"] => string(17)
"Apache-Coyote/1.1" ["content-type"] => string(16)
"application/json" ["content-length"] => string(3)
"313" ["date"] => string(29)
"Fri, 08 Jul 2016 00:22:29 GMT" ["connection"] => string(5)
"close"
}
["body"] => string(313){
"version ":{
"major ":1,
"minor ":6,
"revision ":0
},
"enquiry ":{
"id ":"21a2a688-c09b-48bc-8cb0-0ad596c18447",
"creationTime ":1467937344745,
"lastUpdateTime ":1467937344753,
"status ":"OPEN ",
"from ":"test ",
"email ":"[email protected] ",
"message ":"test ",
},
"enquiries":null
}
["response"] => array(2) {
["code"] => int(202)
["message"] => string(8)
"Accepted"
}
["cookies"] => array(0) {}
["filename"] => NULL
}
刚刚访问相应的索引,JSON字符串与阵列标志进行解码,然后把它像任何正常阵列 – Ghost
上面的代码是响应或与json_decode响应解码?我想看到原始的回应。 –
这是我从服务中获得的原始响应。我实际上是PHP新手,非常感谢任何帮助。 – user3736514