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, 1962🔥, 0💬
Popular Posts:
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
How to use the urllib.request.Request object to build more complex HTTP request? The urllib.request....
How to Install Docker Desktop 2.5.0 on Windows 10? You can follow this tutorial to Install Docker De...
How To Set session.gc_divisor Properly in PHP? As you know that session.gc_divisor is the frequency ...