php file put content
snippet in php

file_put_contents php json file

user2504

$data[] = $_POST['data'];

$inp = file_get_contents('results.json');
$tempArray = json_decode($inp);
array_push($tempArray, $data);
$jsonData = json_encode($tempArray);
file_put_contents('results.json', $jsonData);

php file put content

user5851

<?php
$data = ["a@gmail2.com" => ["more" => ["yes" => "More"]]];

$inp = file_get_contents('results.json');
$tempArray = json_decode($inp);
array_push($tempArray, $data);
$jsonData = json_encode($tempArray);
file_put_contents('results.json', $jsonData);

php file_put_contents

user1846


<?php

echo file_put_contents("test.txt","Hello World. Testing!");

?>