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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -