gpt4 book ai didi

php - 在while循环中解析json数据

转载 作者:行者123 更新时间:2023-11-29 23:00:06 25 4
gpt4 key购买 nike

嗨,我是 json 和 php 新手,我尝试在 php 中的 while 循环内解析 json 数据,但它返回空。

请帮忙。这是我的代码:

http://pastebin.com/i9z7YBwY

这是我的表格数据

|id|data|
_________
|11|[{"id":"1","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Company","value":"Destination Queenstown"},{"id":"2","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Your Name","value":"Ella Zhang"}]|
_________
|12|[{"id":"1","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Company","value":"New Company"},{"id":"2","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Your Name","value":"Michael"}]|
_________
|13|[{"id":"1","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Company","value":"Blitzc inc"},{"id":"2","is_email":"false","add_to_day_hour_info":"false","add_to_day_hour_body":"false","translation":"Your Name","value":"Yudha"}]|
_________

最佳答案

您需要将第二个参数设置为true,以告诉它以关联数组的形式返回结果。

$array = json_decode($array, true);

这有很清楚的记录here在 PHP 手册中。

然后您可以像这样访问:

$array['value']

关于php - 在while循环中解析json数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28536677/

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