my json file with php, they just disappear, have someone faced something like that?
What code?
function save($data = [], $path) // USED TO SAVE IN msgsSet { file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); } $arrayuser[] = 123; $myhumblepath = "file.json"; save($arrayuser, $myhumblepath);
it will overwrite each time? Right? maybe you need to get the existing data, and then append 😅🤔
❌❌
file_put_contents is fine. As far as I can see your code makes your file contain the following content: [123] Is that what's happening and/or expected?
it is making a array of ids
the file after a while getting empty (null)
So the file size is 0 because its empty? Or is the file size 4 bytes because it contains null?
Обсуждают сегодня