我的JSON响应有一个小问题。
我将其倒在PHP代码中,结果是我在此处附加的
如何转储statusText
?
我已经尝试将其解码,并且也尝试过:
dump($myVar['statusText']);
或类似的东西
(要获得我发布的JSON的转储,我刚刚做过 dump($myVar);
(
JsonResponse {#325
#data: "{"code":"OK","status":"ok","data":{"UUID":"f239ae18-98af-4224-8b4f-7713c71a5576","order":{something here },"orderRows":[something else here}}"
#callback: null
#encodingOptions: 271
+headers: ResponseHeaderBag {#326
#computedCacheControl: array:2 [
"no-cache" => true
"private" => true
]
#cookies: []
#headerNames: array:4 [
"content-type" => "Content-Type"
"access-control-allow-origin" => "Access-Control-Allow-Origin"
"cache-control" => "Cache-Control"
"date" => "Date"
]
#headers: array:4 [
"content-type" => array:1 [
0 => "application/json; charset=utf-8"
]
"access-control-allow-origin" => array:1 [
0 => "*"
]
"cache-control" => array:1 [
0 => "no-cache, private"
]
"date" => array:1 [
0 => "Mon, 06 May 2019 08:15:28 GMT"
]
]
#cacheControl: []
}
#content: "{"code":"OK","status":"ok","data":{"UUID":"f239ae18-98af-4224-8b4f-7713c71a5576","order":{something},"orderRows":[something else}}"
#version: "1.0"
#statusCode: 200
#statusText: "OK"
#charset: null
}
只是想看看 "status" => 'ok'
,我的生活将是完美的:D
查看此输出,看起来代码也存储在内容中。
"状态":"确定"
因此,按照getData()
方法的此文档,您应该能够检索状态:
$data = $myVar->getData();
var_dump($data->status);
预计这会返回一串" OK"。