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, ∼2463🔥, 0💬
Popular Posts:
What is EPUB 3.0 Metadata "dc:description" Element? EPUB 3.0 Metadata "dc:description" is an optiona...
How to validate the id_token signature received from Azure AD v2.0 authentication response? You can ...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...
How to use the urllib.request.Request object to build more complex HTTP request? The urllib.request....
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...