当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_rmdir函数代码示例

本文整理汇总了PHP中ftp_rmdir函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_rmdir函数的具体用法?PHP ftp_rmdir怎么用?PHP ftp_rmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_rmdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clean

 /**
  * @param string $file
  */
 private function clean($file)
 {
     if (ftp_size($this->connection, $file) == -1) {
         $result = ftp_nlist($this->connection, $file);
         foreach ($result as $childFile) {
             $this->clean($childFile);
         }
         ftp_rmdir($this->connection, $file);
     } else {
         ftp_delete($this->connection, $file);
     }
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:15,代码来源:FtpTestCase.php

示例2: removeDirectoryJailed

 /**
  * {@inheritdoc}
  */
 protected function removeDirectoryJailed($directory)
 {
     $pwd = ftp_pwd($this->connection);
     if (!ftp_chdir($this->connection, $directory)) {
         throw new FileTransferException("Unable to change to directory @directory", NULL, array('@directory' => $directory));
     }
     $list = @ftp_nlist($this->connection, '.');
     if (!$list) {
         $list = array();
     }
     foreach ($list as $item) {
         if ($item == '.' || $item == '..') {
             continue;
         }
         if (@ftp_chdir($this->connection, $item)) {
             ftp_cdup($this->connection);
             $this->removeDirectory(ftp_pwd($this->connection) . '/' . $item);
         } else {
             $this->removeFile(ftp_pwd($this->connection) . '/' . $item);
         }
     }
     ftp_chdir($this->connection, $pwd);
     if (!ftp_rmdir($this->connection, $directory)) {
         throw new FileTransferException("Unable to remove to directory @directory", NULL, array('@directory' => $directory));
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:29,代码来源:FTPExtension.php

示例3: mrmdir

 function mrmdir($directory)
 {
     if (!$this->conn_id) {
         return false;
     }
     return @ftp_rmdir($this->conn_id, $directory);
 }
开发者ID:polarlight1989,项目名称:08cms,代码行数:7,代码来源:ftp.fun.php

示例4: rmdir

 public function rmdir($dir)
 {
     if (FALSE === ftp_rmdir($this->link, $dir)) {
         $this->errormsg = "Can't remove this dir";
         return FALSE;
     }
     return TRUE;
 }
开发者ID:knowsee,项目名称:uoke_framework,代码行数:8,代码来源:ftp.class.php

示例5: deleteFolder

 public function deleteFolder(string $path) : bool
 {
     if (ftp_rmdir($this->connect, $path)) {
         return true;
     } else {
         throw new FolderNotFoundException($path);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:8,代码来源:Forge.php

示例6: rmdir

 /**
  * Updates Varien's method that accepts the $recursive param but doesn't do anything
  * with it. This new method calls rmdirRecursive() if $recursive is true.
  *
  * @param string $dir
  * @param bool $recursive
  * @return boolean
  */
 public function rmdir($dir, $recursive = false)
 {
     if ($recursive) {
         return $this->rmdirRecursive($dir);
     } else {
         return @ftp_rmdir($this->_conn, $dir);
     }
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:16,代码来源:Ftp.php

示例7: ftp_rmdirr

/**
 * Recursively delete the files in a directory via FTP.
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.0
 * @link        http://aidanlister.com/2004/04/recursively-deleting-directories-via-ftp/ 
 * @param       resource $ftp_stream   The link identifier of the FTP connection
 * @param       string   $directory    The directory to delete
 */
function ftp_rmdirr($ftp_stream, $directory)
{
    // Sanity check
    if (!is_resource($ftp_stream) || get_resource_type($ftp_stream) !== 'FTP Buffer') {
        return false;
    }
    // Init
    $i = 0;
    $files = array();
    $folders = array();
    $statusnext = false;
    $currentfolder = $directory;
    // Get raw file listing
    $list = ftp_rawlist($ftp_stream, $directory, true);
    // Iterate listing
    foreach ($list as $current) {
        // An empty element means the next element will be the new folder
        if (empty($current)) {
            $statusnext = true;
            continue;
        }
        // Save the current folder
        if ($statusnext === true) {
            $currentfolder = substr($current, 0, -1);
            $statusnext = false;
            continue;
        }
        // Split the data into chunks
        $split = preg_split('[ ]', $current, 9, PREG_SPLIT_NO_EMPTY);
        $entry = $split[8];
        $isdir = $split[0][0] === 'd' ? true : false;
        // Skip pointers
        if ($entry === '.' || $entry === '..') {
            continue;
        }
        // Build the file and folder list
        if ($isdir === true) {
            $folders[] = $currentfolder . '/' . $entry;
        } else {
            $files[] = $currentfolder . '/' . $entry;
        }
    }
    // Delete all the files
    foreach ($files as $file) {
        ftp_delete($ftp_stream, $file);
    }
    // Delete all the directories
    // Reverse sort the folders so the deepest directories are unset first
    rsort($folders);
    foreach ($folders as $folder) {
        ftp_rmdir($ftp_stream, $folder);
    }
    // Delete the final folder and return its status
    return ftp_rmdir($ftp_stream, $directory);
}
开发者ID:vortechs2000,项目名称:aidanlister-code,代码行数:64,代码来源:function.ftp_rmdirr.php

示例8: ftp_rdel

function ftp_rdel($handle, $path)
{
    if (@ftp_delete($handle, $path) === false) {
        if ($children = @ftp_nlist($handle, $path)) {
            foreach ($children as $p) {
                ftp_rdel($handle, $p);
            }
        }
        @ftp_rmdir($handle, $path);
    }
}
开发者ID:MrTurth,项目名称:Mr.Green-MTA-Resources,代码行数:11,代码来源:checkmtamap.php

示例9: del

 public function del($file, $recursive = false)
 {
     if (!$recursive) {
         return @ftp_delete($this->stream, $file);
     }
     if (!@ftp_delete($this->stream, $file)) {
         foreach ($this->ls($file) as $item) {
             $this->del($item, $recursive);
         }
         @ftp_rmdir($this->stream, $file);
     }
 }
开发者ID:wanggeopens,项目名称:own-libs,代码行数:12,代码来源:FtpUtil.php

示例10: deleteDirUndFiles

function deleteDirUndFiles($conn_id, $pfad)
{
    $return = @ftp_chdir($conn_id, $pfad);
    $file_list = ftp_nlist($conn_id, "");
    foreach ($file_list as $file) {
        if ($file == "." || $file == "..") {
            //echo "nix";
        } else {
            $return = @ftp_delete($conn_id, $pfad . $file);
        }
    }
    $return = @ftp_rmdir($conn_id, $pfad);
}
开发者ID:haraldmueller,项目名称:lcmeilen.ch,代码行数:13,代码来源:show.php

示例11: mappa_torles

function mappa_torles($mappa, $hova, $id)
{
    if (!(ftp_rmdir($id, "{$hova}/{$mappa}") || ftp_delete($id, "{$hova}/{$mappa}"))) {
        $list = ftp_nlist($id, "{$hova}/{$mappa}");
        if (!empty($list)) {
            foreach ($list as $ezeket) {
                mappa_torles($ezeket, "", $id);
            }
        }
    }
    ftp_rmdir($id, "{$hova}/{$mappa}");
    return header("Location:{$PHP_SELF}?mit=" . urlencode($hova));
}
开发者ID:DeteCT0R,项目名称:gts-minicp,代码行数:13,代码来源:funkciok.php

示例12: removeDir

 public function removeDir($ftp_folder, $path, $ftp)
 {
     $directories = explode('/', $path);
     foreach ($directories as $directory) {
         $files = ftp_nlist($ftp, $ftp_folder . $path);
         if (count($files) > 2) {
             break;
         }
         if (count($files) == 2) {
             ftp_rmdir($ftp, $ftp_folder . $path);
             str_replace('/' . $directory, '', $path);
         }
     }
 }
开发者ID:fernandocchaves,项目名称:ftpdeploy,代码行数:14,代码来源:FTPDeploy.php

示例13: deleteDirectory

 public function deleteDirectory($remoteDir)
 {
     // Require a connection and a login
     $this->validateState();
     $remoteDir = $this->buildAbsolutePath($remoteDir);
     foreach ($this->listDirectory($remoteDir) as $item) {
         switch ($item['type']) {
             case 'file':
                 $this->deleteFile("{$remoteDir}/{$item['name']}");
                 break;
             case 'directory':
                 $this->deleteDirectory("{$remoteDir}/{$item['name']}");
                 break;
         }
     }
     @ftp_rmdir($this->ftpResource, $remoteDir);
 }
开发者ID:codeaken,项目名称:ftpclient,代码行数:17,代码来源:FtpClient.php

示例14: ftp_rdel

 public function ftp_rdel($path)
 {
     if (@ftp_delete($this->ftp, $path) === false) {
         $list = str_replace(' ', '\\ ', str_replace('\\ ', ' ', $path));
         if ($children = @ftp_nlist($this->ftp, $list . DIRECTORY_SEPARATOR)) {
             foreach ($children as $p) {
                 if ($p != '.' && $p != '..') {
                     $tmp = $path . DIRECTORY_SEPARATOR . $p;
                     $this->ftp_rdel($tmp);
                 }
             }
         }
         if (!@ftp_rmdir($this->ftp, $path . DIRECTORY_SEPARATOR)) {
             $this->error .= 'Não foi possível remover ' . $path . '<br>';
         }
     }
     return $this->error;
 }
开发者ID:jorgejr568,项目名称:file-manager,代码行数:18,代码来源:ftpCon.php

示例15: rmAll

 function rmAll($dst_dir, $debug = 0)
 {
     if (!$dst_dir) {
         return false;
         exit;
     }
     $dst_dir = preg_replace("/\\/\$/", "", $dst_dir);
     // remove trailing slash
     $ar_files = ftp_nlist($this->conn_id, $dst_dir);
     if (is_array($ar_files)) {
         // makes sure there are files
         if (count($ar_files) == 1) {
             // if its only a file
             return ftp_delete($this->conn_id, $ar_files[0]);
         } else {
             foreach ($ar_files as $st_file) {
                 // for each file
                 if ($st_file == "." || $st_file == "..") {
                     continue 1;
                 }
                 $fl_file = "{$dst_dir}/{$st_file}";
                 $ftp_size = ftp_size($this->conn_id, $fl_file);
                 if ($ftp_size == -1) {
                     // check if it is a directory
                     $this->rmAll($fl_file);
                     // if so, use recursion
                 } else {
                     if ($debug) {
                         echo "File: {$fl_file} | {$ftp_size}\n";
                     } else {
                         ftp_delete($this->conn_id, $fl_file);
                     }
                     // if not, delete the file
                 }
             }
         }
     }
     if ($debug) {
         echo "Dir: {$dst_dir} \n";
     } elseif (count($ar_files) != 1) {
         echo @ftp_rmdir($this->conn_id, $dst_dir) ? "{$dst_dir} deleted!\n" : "Can't remove {$dst_dir}: No such file or directory";
     }
     // delete empty directories
 }
开发者ID:hukumonline,项目名称:admin,代码行数:44,代码来源:Ftp.php


注:本文中的ftp_rmdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。