Php Create File If Not Exist

[Solved] Php Create File If Not Exist | Php - Code Explorer | yomemimo.com
Question : php create file if not exist

Answered by : nadim-al-abdou

<?php
$file = 'test.txt';
if(!is_file($file)){ $contents = 'This is a test!'; // Some simple example content. file_put_contents($file, $contents); // Save our content to the file.
}
?>

Source : https://stackoverflow.com/questions/20580017/php-create-a-file-if-not-exists | Last Update : Thu, 24 Jun 21

Answers related to php create file if not exist

Code Explorer Popular Question For Php