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, 1286👍, 0💬
Popular Posts:
How To Submit Values without Using a Form in PHP? If you know the values you want to submit, you can...
How to use the API operation 2017 version setting "Rewrite URL template"? The API operation setting ...
Where Is the Submitted Form Data Stored in PHP? When a user submit a form on your Web server, user e...
How to login to the Developer Portal internally by you as the publisher? Normally, the Developer Por...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...