How to Delete a File in PHP

Configurare noua (How To)

Situatie

To delete a file in PHP, use the unlink function. Let’s go through an example to see how it works.

Solutie

<?php
If (unlink('C:\Users\flcri\Desktop\Solutii\3\test.txt')) {
  // file was successfully deleted
} else {
  // there was a problem deleting the file
}
?>
The first argument of the unlink function is a filename which you want to delete. The unlink function returns either TRUE or FALSE, depending on whether the delete operation was successful.

Tip solutie

Permanent

Voteaza

(8 din 23 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?