gpt4 book ai didi

php - 如何在 php 中读取 JsonResponse

转载 作者:行者123 更新时间:2023-12-02 13:49:17 25 4
gpt4 key购买 nike

如何从这里获取ID

JsonResponse {#457 ▼
#data: "{"bill":{"id":11,"invoice_no":"9m36r9_1459170388239"}}"
#callback: null
}

我从这个 Laravel 代码中得到这个输出

return Response::json($response);

我尝试了 json_decode 但在这里不起作用,出现了空白输出。

感谢您的帮助。

最佳答案

尝试这样

$jsonResponse = Response::json([
'id' => 1,
'test' => 'test'
]);

$content = $jsonResponse->getContent();
$array = json_decode($content, true);
$id = $array['id']

关于php - 如何在 php 中读取 JsonResponse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36278112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com