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, 1595🔥, 0💬
Popular Posts:
How to add request body examples to my Azure API operation to make it more user friendly? If you hav...
What are "*..." and "**..." Wildcard Parameters in Function Definitions? If you want to define a fun...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service o...
Can You Add Values to an Array without Keys in PHP? Can You Add Values to an Array with a Key? The a...