我收到 JSON 响应
@foreach($logs as $log)
<div class="modal-body">
{{ $log->general }}
</div>
<div class="modal-body">
{{ $log->response_headers }}
</div>
@endforeach
我的回复结构不是这样的,目前可读
General
{
"host": "abcd-io.test",
"path": "api/v1/companies/hello.com",
"request_ip": "127.0.0.1"
}
response_headers
{
"X-Powered-By": [
"Express"
],
"Access-Control-Allow-Origin": [
"*"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"4857"
],
"ETag": [
"W/\"12f9-UhKH0rSAm7BiHIeW5pbrH1gphXs\""
],
"Date": [
"Sat, 20 Jun 2020 12:51:28 GMT"
],
"Connection": [
"keep-alive"
]
}
控制器
public function index() {
$logs = Log::where('user_id',auth()->user()->id)
->orderBy('created_at', 'DESC')->get();
return view('api.logs', compact('logs'));
}
我希望分别显示host和abcd-io.test
我尝试使用 {{ $log->general['host'] }}但没有成功
哔哔one
皈依舞