how to code PHP append text to a file


$fh = fopen('fileName.txt', 'a') or die("can't open file"); //open file for appending data
$text = "this is text to be written to file, so hello how are you\n";
fwrite($fh, $text); //write text on the end of file.
fclose($fh);
?>

Posted in |