ftp_delete-文件存在但未找到


ftp_delete - file exists but not found

我有一个奇怪的问题。。。正如你所看到的。。o.o

$connection = ftp_connect(FTP_SERVER);
$login = ftp_login($connection, FTP_USERNAME, FTP_PASSWORD);
if ($login) {
    $file = "" . DOCUMENT_ROOT . "/uploaded_files/" . Session::GetSession('username') . "/" . $result['ftp_file_name'] . "";
    if (file_exists($file)) {
        echo "file_exists";
        if (ftp_delete($connection, $file)) {
            echo "deleted";
        } else {
            echo "file_not_found";
        }
    } else {
        echo "does_not_exists";
    }
} else {
    echo "not_logged_in";
}

这就是结果:

file_exists
警告:ftp_delete():在中找不到文件C: ''programy''examplep''htdocs''ajax handler.php235file_not_found

有人能告诉我为什么会发生这种事吗?这毫无意义。。

删除DOCUMENT_ROOT并在ftp_delete之前添加一个"at"(@)符号尝试如下

 $fileTmp =  "/uploaded_files/" . Session::GetSession('username') . "/" .                $result['ftp_file_name'] .$get_file "";
    if (@ftp_delete($connection, $fileTmp)){
$connection = ftp_connect(FTP_SERVER);
            $login = ftp_login($connection, FTP_USERNAME, FTP_PASSWORD);
            if ($login) {
                $get_file=$_GET['uploaded_files'];
                $file = "" . DOCUMENT_ROOT . "/uploaded_files/" . Session::GetSession('username') . "/" . $result['ftp_file_name'] .$get_file "";
                if (file_exists($file)) {
                    echo "file_exists";
                    if (ftp_delete($connection, $file)) {
        echo "deleted";
                    } else {
                        echo "file_not_found";
                    }
                } else {
                    echo "does_not_exists";
                }
            }
        } else {
            echo "not_logged_in";
        }
ftp_close($connection);