Deleting Files

Files can be deleting using the unlink() function. As will all functions that remove data, make double sure that you really want the data gone for good, and that you don’t delete the wrong data!

To lessen confusion, make sure that your file is closed before you try to delete/unlink it. Then, a single line of code with do the trick:

<?php
unlink('storage.txt');

?>

It’s as easy as that!

Summary:

Function Description
unlink() Deletes a File

Comments