• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ftp_rmdir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ftp_rmdir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 <[email protected]>
 * @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


示例16: recursive_delete

function recursive_delete($ftp, $path)
{
    $files = ftp_rawlist($ftp, $path);
    foreach ($files as $file) {
        $i = explode(' ', $file);
        $filename = $i[count($i) - 1];
        if (strpos($file, '<DIR>') !== false) {
            recursive_delete($ftp, $path . '/' . $filename);
        } else {
            if (!ftp_delete($ftp, $path . '/' . $filename)) {
                return false;
            }
        }
    }
    if (!ftp_rmdir($ftp, $path)) {
        return false;
    }
    return true;
}
开发者ID:hoksi,项目名称:mangolight-editor,代码行数:19,代码来源:rmdir.php


示例17: TestFTPDir

 static function TestFTPDir($conn_id, $file, $testDir)
 {
     $success = false;
     ftp_chdir($conn_id, '/');
     $random_name = 'gpeasy_random_' . rand(1000, 9999);
     $random_full = rtrim($file, '/') . '/' . $random_name;
     $test_full = rtrim($testDir, '/') . '/' . $random_name;
     ob_start();
     if (!@ftp_mkdir($conn_id, $random_full)) {
         ob_end_clean();
         return false;
     }
     ob_end_clean();
     if (file_exists($test_full)) {
         $success = true;
     }
     ftp_rmdir($conn_id, $random_full);
     return $success;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:19,代码来源:ftp.php


示例18: prepare

 /**
  *  preprocess Index action.
  *
  *  @access    public
  *  @return    string  Forward name (null if no errors.)
  */
 function prepare()
 {
     if ($this->af->validate() == 0) {
         $username = $this->af->get('ftp_username');
         $password = $this->af->get('ftp_password');
         if ($conn_id = ftp_connect('localhost')) {
             if (ftp_login($conn_id, $username, $password)) {
                 $ftp_root = $this->seekFTPRoot($conn_id);
                 if ($ftp_root !== false) {
                     $chroot = substr(BASE, strlen($ftp_root));
                     $tmp_file = $chroot . '/tmp/tmp_file';
                     $tmp_dir = $chroot . '/tmp/tmp_dir';
                     $pwd = ftp_pwd($conn_id);
                     if (ftp_put($conn_id, $tmp_file, __FILE__, FTP_BINARY)) {
                         if (ftp_delete($conn_id, $tmp_file)) {
                             if (ftp_mkdir($conn_id, $tmp_dir)) {
                                 if (ftp_rmdir($conn_id, $tmp_dir)) {
                                     return null;
                                 } else {
                                     $this->ae->add('ftp_rmdir', _('Failed ftp operation rmdir.'));
                                 }
                             } else {
                                 $this->ae->add('ftp_mkdir', _('Failed ftp operation mkdir.'));
                             }
                         } else {
                             $this->ae->add('ftp_delete', _('Failed ftp operation delete.'));
                         }
                     } else {
                         $this->ae->add('ftp_put', _('Failed ftp operation put.') . sprintf('[debug] pwd=>%s, __FILE__=>%s', $pwd, __FILE__));
                     }
                 } else {
                     $this->ae->add('ftp_root_path', _('Failed seek ftp root path.'));
                 }
             } else {
                 $this->ae->add('ftp_login', _('FTP login failed.'));
             }
         } else {
             $this->ae->add('ftp_connect', _('Failed ftp connect to localhost.'));
         }
     }
     return 'json_error';
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:48,代码来源:Ftpcheck.php


示例19: ftp_rrmdir

function ftp_rrmdir($ftp_stream, $directory)
{
    $rrmdir = function ($ftp_stream, $directory) {
        $cwd = ftp_pwd($ftp_stream);
        if (@ftp_chdir($ftp_stream, $directory)) {
            $nlist = ftp_nlist($ftp_stream, '.');
            if ($nlist) {
                foreach ($nlist as $file) {
                    ftp_rrmdir($ftp_stream, $file);
                }
            }
            ftp_chdir($ftp_stream, $cwd);
            $ok = @ftp_rmdir($ftp_stream, $directory);
        } else {
            $ok = @ftp_delete($ftp_stream, $directory);
        }
        return $ok;
    };
    return $rrmdir($ftp_stream, $directory);
}
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:20,代码来源:ftp_rrmdir.php


示例20: _deleteDirectory

 protected function _deleteDirectory($sPath)
 {
     if ($this->_isDirectory($sPath)) {
         if (substr($sPath, -1) != '/') {
             $sPath .= '/';
         }
         if (($aFiles = @ftp_nlist($this->_rStream, $sPath)) !== false) {
             foreach ($aFiles as $sFile) {
                 if ($sFile != '.' && $sFile != '..') {
                     $this->_deleteDirectory(false === strpos($sFile, '/') ? $sPath . $sFile : $sFile);
                 }
             }
         }
         if (!@ftp_rmdir($this->_rStream, $sPath)) {
             return false;
         }
     } else {
         if (!@ftp_delete($this->_rStream, $sPath)) {
             return false;
         }
     }
     return true;
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:23,代码来源:BxDolFtp.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_set_option函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_rename函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap