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, 1946🔥, 0💬
Popular Posts:
How to troubleshoot the Orderer peer? The Docker container terminated by itself. You can follow this...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
Where to find tutorials on RSS specifications? I want to learn it to describe my API services. Here ...
How to use the "set-body" Policy Statement for an Azure API service operation? The "set-body" Policy...