Function To Create File If Its Not Exist In Php

[Solved] Function To Create File If Its Not Exist In Php | 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 function to create file if its not exist in php

Code Explorer Popular Question For Php