How to delete the file using php
We can delete the file using php with the help of unlink function.
Define this function like this:
unlink ( string $filename [, resource $context ] ) |
Parameter:
File name:
Path to the file. |
Context:
Context support was added with PHP 5.0.0 |
Example:
<?php $fh = fopen(‘file.html’, ‘a’); fwrite($fh, ‘<h1>Hello world!</h1>’); fclose($fh); unlink(‘file.html’); |