当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > unlink() 函数
The unlink() function deletes a file.
unlink()函数的作用是:删除一个文件。
This function returns TRUE on success, or FALSE on failure.
如果函数成功执行将返回True,如果失败将返回False。
unlink(filename,context) |
| Parameter 参数 | Description 描述 |
|---|---|
| filename | Required. Specifies the file to delete 必要参数。指定需要删除的文件对象 |
| context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream 可选参数。指定需要处理的文件的context;Context是一组用来修饰文本流[stream]内容的选项 |
<?php
$file = "test.txt";
if (!unlink($file)) { echo ("Error deleting $file"); }
else { echo ("Deleted $file"); }
?> |
评论 (0) All