【发布时间】:2020-09-05 09:51:51
【问题描述】:
JSON 文件以前的数据,其中只有一条记录
JSON 数据描述了一个数组,该数组的每个元素都是一个对象。
[
{
id : '1'
name : 'dfg ggg',
age : '17',
address : 'somewhere',
dob : '10/05/2002'
}
]
我只想在顶部添加具有相同对象的新数组
然后我想在顶部添加这样的数据...
在这里,我在顶部添加了另外 2 个记录作为数组,这是前 2 个数组。
[
{
id : '3'
name : 'sssd dsyz',
age : '10',
address : 'somewhere',
dob : '10/05/2010'
},
{
id : '2'
name : 'Abc Xyz',
age : '15',
address : 'somewhere',
dob : '10/05/2005'
},
{
id : '1'
name : 'dfg ggg',
age : '17',
address : 'somewhere',
dob : '10/05/2002'
}
]
【问题讨论】:
-
对不起,不。我想将数据附加到顶部的 JSON 文件中。
标签: php json file object append