body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 900px;
margin: 0 auto;
padding: 20px;
}
h1, h2, h3 {
color: #2c3e50;
}
h1 {
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
}
.code-block {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 4px;
padding: 15px;
overflow-x: auto;
margin: 20px 0;
}
.code-block pre {
margin: 0;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
font-size: 14px;
}
.parameter-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.parameter-table th, .parameter-table td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
.parameter-table th {
background-color: #f2f2f2;
}
.note {
background-color: #fff3cd;
border-left: 4px solid #ffc107;
padding: 15px;
margin: 20px 0;
}
.example-output {
background-color: #e8f4fd;
border-left: 4px solid #2196F3;
padding: 15px;
margin: 10px 0;
}
a {
color: #3498db;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
PHP unlink() Function
Note: This is a translation of a Chinese tutorial. All code blocks and HTML tags have been preserved as requested.
Definition and Usage
The unlink() function deletes a file.
If successful, this function returns TRUE. If it fails, it returns FALSE.
Syntax
unlink(filename, context)
| Parameter |
Description |
| filename |
Required. Specifies the file to be deleted. |
| context |
Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. |
Example
<?php
$file = "test.txt";
if (!unlink($file))
{
echo ("Error deleting $file");
}
else
{
echo ("Deleted $file");
}
?>
Possible Output:
Deleted test.txt
Related Functions