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, 1726🔥, 0💬
Popular Posts:
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...
How to use .NET CLR Types in Azure API Policy? By default, Azure imports many basic .NET CLR (Common...
What Is HTML? HTML (HyperText Markup Language) is the standard markup language for creating Web page...
What Is session_register() in PHP? session_register() is old function that registers global variable...
FYIcenter JSON Validator and Formatter is an online tool that checks for syntax errors of JSON text ...