Tutorial : Write a file using php


Read {count} times since 2020

Hi. You must have heard of writing file using PHP. You want to know how to do this. I’ll tell you. Please follow these steps.
1 – Open your php file in text editor. Paste this code in it.

    $myFile = "file.html";
    $fh = fopen($myFile, ‘a+’ );
    $stringData = ("Hello");
    fwrite($fh, $stringData);
    fclose($fh);
?>

This will write Hello to a file named file.html. Enjoy!!!

Show Comments