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, 1218👍, 0💬
Popular Posts:
Where to get the detailed description of the json_encode() Function in PHP? Here is the detailed des...
What Is the 2017 Version of Azure API Management Service? The 2017 Version of Azure API Management a...
How to access Request body from "context.Request.Body" object in Azure API Policy? Request body is t...
dev.FYIcenter.com is a Website for software developer looking for software development technologies,...
How to use the "send-one-way-request" Policy statement to call an extra web service for an Azure API...