The
unlink() filesystem function in PHP will delete or remove files from the server for you. Delete files like images, documents, media files, and more.
<?php
$target = "information.txt";
// See if it exists before attempting deletion on it
if (file_exists($target)) {
unlink($target); // Delete now
}
// See if it exists again to be sure it was removed
if (file_exists($target)) {
echo "Problem deleting " . $target;
} else {
echo "Successfully deleted " . $target;
}
?>
Successfully deleted information.txt