Using fopen() for Reading and Writing Files in PHP


Open a file for reading or writing.

Source Code

$file = fopen("test.txt", "w");
if ($file) {
    fwrite($file, "Hello, World!");
    fclose($file);
} else {
    echo "Unable to open file!";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments