Menulis ke File PHP
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, "Content to write to file");
fclose($myfile);
Thoughtful Termite
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, "Content to write to file");
fclose($myfile);
$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
$data = ["[email protected]" => ["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
$filename = "test.txt";
$data = "hi this I am https://t.me/mrbeandev";
file_put_contents($filename,$data);
?>
file_put_contents ($filename, $data, $flags = 0, $context = null): int