Emptying a file with php -
possible duplicate:
php: there command can delete contents of file without opening it?
how empty .txt file on server php command?
here's way emptying if exists , doesn't have problem of using file_exists, the file may cease exist between file_exists call , fopen call.
$f = @fopen("filename.txt", "r+"); if ($f !== false) { ftruncate($f, 0); fclose($f); }
Comments
Post a Comment