September 2001
Intermediate to advanced
768 pages
32h 45m
English
boolean unlink(string path) Deletes a file.
Returns:
TRUE on success; FALSE on error
Description:
unlink() deletes a file. If the file cannot be deleted, the function returns FALSE and generates an error.
Note:
Lack of adequate permissions or file locking are the most common reasons why calls to unlink() fail.
Example:
<?php
$filepath = "/tmp/test.txt";
if (! unlink ($filepath)) {
echo ("Couldn't delete file");
} else {
echo ("Removed $filepath");
}
?>
|
Read now
Unlock full access