Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用rmdir()在php中删除文件_Php - Fatal编程技术网

无法使用rmdir()在php中删除文件

无法使用rmdir()在php中删除文件,php,Php,当我试图删除空目录时,第93行的和第99行的出现以下警告: Warning: unlink(/data/sites/web/xxx/www/uploads/file/2021-04-02/.nfs0000000059f70c14000017a9): Device or resource busy in /data/sites/web/xxx/www/dreq/req.php on line 93 Warning: rmdir(/data/sites/web/xxx/www/uploads/fi

当我试图删除空目录时,第93行的
和第99行的
出现以下警告:

Warning: unlink(/data/sites/web/xxx/www/uploads/file/2021-04-02/.nfs0000000059f70c14000017a9): Device or resource busy in /data/sites/web/xxx/www/dreq/req.php on line 93

Warning: rmdir(/data/sites/web/xxx/www/uploads/file/2021-04-02): Directory not empty in /data/sites/web/xxx/www/dreq/req.php on line 99
以下是删除功能:

function rrmdir($src) {
    $dir = opendir($src);
    while(false !== ( $file = readdir($dir)) ) {
        if (( $file != '.' ) && ( $file != '..' )) {
            $full = $src . '/' . $file;
            if ( is_dir($full) ) {
                rrmdir($full); // On line 93
            }
            else {
                unlink($full);
            }
        }
    }
    closedir($dir);
    rmdir($src); // On line 99
}

这里的问题是什么?

问题1。使用
lsof-f | grep filename检查哪个进程保存该文件以检查哪个进程保存该资源

问题2。检查手册,目录必须为空

尝试删除以dirname命名的目录。目录必须是 为空,且相关权限必须允许此操作。紧急警告 故障时将生成级别错误


您的问题可能在这里有答案:(至少在后面的警告中)@Ash1271但我的功能在另一台服务器上运行良好:谢谢你的回答。第2期。文件绝对是空的
.nfs000000059f70c1400017a9
是一个隐藏文件。这个文件是如何产生的?请参阅本文。