我加载JSON文件来自:PHP - 加载JSON,编辑和保存
{ "timestampRead": [11, 22, 33], "timestampCurrent": [66, 77, 88] }
到PHP:
$local_json = json_decode(file_get_contents('/Temp/chat-users.json'));
,我不知道我可以:
- 更新timestampRead所有值(
$local_json->timestampRead[] = '99'?
) - 更新一个在timestampCurrent(值
$local_json->timestampCurrent[2] = '33'
) - 保存更新的JSON到文件(
$local_json array to json
)
[如何更新/编辑以.json的可能重复文件使用PHP](http://stackoverflow.com/questions/17806224/how-to-update-edit-json-file-using-php) – vzamanillo
你尝试过什么吗?它有用吗?如果不是,它以什么方式不起作用? –
线索 - 1和2工作。 3 - 你认为json_decode的反面可能是什么?你认为file_get_contents的反义词可能是什么?最后的线索 - php.net –