unlink function can use Delete a file in php
example unlink function
<?php
$fh = fopen('check.html', 'a');
fwrite($fh, '<h1>Hello world!</h1>');
fclose($fh);
mkdir('checkdir', 0777);
unlink('check.html');
unlink('checkdir');
?>
$fh = fopen('check.html', 'a');
fwrite($fh, '<h1>Hello world!</h1>');
fclose($fh);
mkdir('checkdir', 0777);
unlink('check.html');
unlink('checkdir');
?>