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, ∼2517🔥, 0💬
Popular Posts:
How to run CMD Commands in Dockerfile to change Windows Docker images? When building a new Windows i...
Where to find tutorials on Microsoft Azure services? Here is a large collection of tutorials to answ...
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...