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, ∼2836🔥, 0💬
Popular Posts:
How to create a new API on the Publisher Dashboard of an Azure API Management Service? If you are ne...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
Why am I getting this "Docker failed to initialize" error? After installing the latest version of Do...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...