如何在laravel中调用响应

时间:2017-06-30 13:01:44

标签: laravel

Response {#695 ▼
  +original: array:2 [▼
    "success" => true
    "data" => array:2 [▼
      "d" => 5
      "ss" => "3.0"
    ]
  ]
  +exception: null
  +headers: ResponseHeaderBag {#691 ▶}
  #content: "{"success":true,"data":{"d":5,"ss":"3.0"}}"
  #version: "1.0"
  #statusCode: 200
  #statusText: "OK"
  #charset: null
}

如何访问ssecho $rating_data['data']['ss'];die;

它说不能使用Illuminate\Http\Response as array类型的对象请建议

1 个答案:

答案 0 :(得分:1)

您可以使用dd()以可读的格式打印结果:

dd(json_decode(json_encode($ResponseData), true));

并返回回复:

return response()->json($ResponseData);

希望这可以帮到你!