删除文件:
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
unlink("test.txt");
?>
unlink() 函数删除文件。
unlink(
filename,
context)
Parameter | Description |
---|---|
filename | Required. Specifies the path to 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 |
返回值: | TRUE 成功,FALSE 失败 |
---|---|
PHP 版本: | 4.0+ |
PHP 变更日志: | PHP 5.0 - 添加了context范围 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!