laravel JsonResponse获取返回的json信息

返回信息:

JsonResponse {#303
  #data: "{"status_code":200,"message":"success","data":{"yh_code":"YH605BEA88E8605","yh_money":null}}"
  #callback: null
  #encodingOptions: 0
  +headers: ResponseHeaderBag {#289
    #computedCacheControl: array:2 [
      "no-cache" => true
      "private" => true
    ]
    #cookies: []
    #headerNames: array:3 [
      "cache-control" => "Cache-Control"
      "date" => "Date"
      "content-type" => "Content-Type"
    ]
    #headers: array:3 [
      "cache-control" => array:1 [
        0 => "no-cache, private"
      ]
      "date" => array:1 [
        0 => "Thu, 25 Mar 2021 01:47:35 GMT"
      ]
      "content-type" => array:1 [
        0 => "application/json"
      ]
    ]
    #cacheControl: []
  }
  #content: "{"status_code":200,"message":"success","data":{"yh_code":"YH605BEA88E8605","yh_money":null}}"
  #version: "1.0"
  #statusCode: 200
  #statusText: "OK"
  #charset: null
  +original: array:3 [
    "status_code" => 200
    "message" => "success"
    "data" => array:2 [
      "yh_code" => "YH605BEA88E8605"
      "yh_money" => null
    ]
  ]
  +exception: null
}

1.

$result->getData(true);

2.

$result->original

 

上一篇:laravel 用 json 模型字段


下一篇:[PHP] laravel的异常处理