嘟嘟社区

[疑问] 请教一个PHP中json_decode的问题,谢谢了


{"reason":"Success","result":{"data":{"year":"2022","holidaylist":"[{"startday": "2022-1-1", "name": "元旦节"}, {"startday": "2022-1-31", "name": "除夕"},{"startday": "2022-2-1","name": "春节"},{"startday": "2022-4-5","name": "清明节"},{"startday": "2022-5-1","name": "劳动节"},{"startday": "2022-6-3","name": "端午节"},{"startday": "2022-9-10","name": "中秋节"},{"startday": "2022-10-1","name": "国庆节"}]","holiday_list":[{"startday":"2022-1-1","name":"元旦节"},{"startday":"2022-1-31","name":"除夕"},{"startday":"2022-2-1","name":"春节"},{"startday":"2022-4-5","name":"清明节"},{"startday":"2022-5-1","name":"劳动节"},{"startday":"2022-6-3","name":"端午节"},{"startday":"2022-9-10","name":"中秋节"},{"startday":"2022-10-1","name":"国庆节"}]}},"error_code":0}

上边这段数据,如何使用json_decode找到相关节日的对应时间呢?谢谢大家了

这是什么JSON数据,不按照规矩来…
把节日字段再解析一遍
循环一遍,生成一个新的array,key是节日