How to create and write to a text file on server disk in PHP

1 Answer

0 votes
<?php
if (!file_exists("ttt"))
    mkdir("ttt", 0777, true);
$fh = fopen("ttt/test.txt", "w");
if (fwrite($fh, "aaa") == FALSE)
    echo "Cannot write to file: 'test.txt'";
?>


answered Apr 23, 2014 by avibootz
edited Apr 23, 2014 by avibootz
...