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, ∼2031🔥, 0💬
Popular Posts:
How to add a new operation to an API on the Publisher Dashboard of an Azure API Management Service? ...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How to use the JSON to XML Conversion Tool at utilities-online.info? If you want to try the JSON to ...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...