目录

PHP unlink() 函数

❮ PHP 文件系统参考

示例

删除文件:

<?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范围

❮ PHP 文件系统参考