Tools, FAQ, Tutorials:
Removing a File in PHP
How To Remove a File in PHP?
✍: FYIcenter.com
If you want to remove an existing file, you can use the unlink() function. Here is a PHP script example on how to use unlink():
<?php
if (file_exists("/temp/todo.txt")) {
unlink("/temp/todo.txt");
print("File removed.\n");
} else {
print("File does not exist.\n");
}
?>
This script will print:
File removed.
If you run this script again, it will print:
File does not exist.
⇐ Removing an Empty Directory in PHP
2016-11-20, ∼2448🔥, 0💬
Popular Posts:
How to use the "set-body" Policy Statement for an Azure API service operation? The "set-body" Policy...
How to pull NVIDIA CUDA Docker Image with the "docker image pull nvidia/cuda" command? If you are ru...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...
What Happens If One Row Has Missing Columns? What happens if one row has missing columns? Most brows...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...