php 删除

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fclose($fh);
判断是否删除了.

$myFile = "testFile.txt";
unlink($myFile);

 

----------------------

$filename = 'file.txt';
fopen($filename,'a+');
if(!unlink($filename))
{
echo "文件{$filename}删除失败";
}
else
{
echo "文件{$filename}删除成功";
}
?>

posted @ 2017-09-14 10:51  刀狂剑痴叶小钗  阅读(92)  评论(0编辑  收藏  举报