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, 1976🔥, 0💬
Popular Posts:
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How to Build my "sleep" Docker image from the Alpine image? I want the container to sleep for 10 hou...
Where to find EPUB Sample Files? Here is a list of EPUB sample files collected by FYIcenter.com team...
How to make application release build with Visual Studio 2017? If you want to make a final release b...
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a...