we can delete any file using unlink() function. The unlink() function accepts one argument only: file name. It is similar to UNIX C unlink() function.
PHP unlink() generates E_WARNING level error if file is not deleted. It returns TRUE if file is deleted successfully otherwise FALSE.
bool unlink ( string $filename [, resource $context ] )
unlink ("file name with directory path")
$filename represents the name of the file to be deleted.
<?php
$status=unlink("dataFile.txt");
if($status){
echo "File deleted successfully";
}else{
echo "Opps Your File Not Delete !";
}
?>
Output :File deleted successfully
© 2024 Easy To Learning. All Rights Reserved | Design by Easy To Learning