本文整理匯總了PHP中Net_SFTP::rmdir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Net_SFTP::rmdir方法的具體用法?PHP Net_SFTP::rmdir怎麽用?PHP Net_SFTP::rmdir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Net_SFTP
的用法示例。
在下文中一共展示了Net_SFTP::rmdir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rmdir
/**
* Delete a directory
*
*/
public function rmdir($dir, $recursive = false)
{
if ($recursive) {
$no_errors = true;
$cwd = $this->_connection->pwd();
if (!$this->_connection->chdir($dir)) {
throw new Exception("chdir(): {$dir}: Not a directory");
}
$list = $this->_connection->nlist();
if (!count($list)) {
// Go back
$this->_connection->chdir($pwd);
return $this->rmdir($dir, false);
} else {
foreach ($list as $filename) {
if ($this->_connection->chdir($filename)) {
// This is a directory
$this->_connection->chdir('..');
$no_errors = $no_errors && $this->rmdir($filename, $recursive);
} else {
$no_errors = $no_errors && $this->rm($filename);
}
}
}
$no_errors = $no_errors && ($this->_connection->chdir($pwd) && $this->_connection->rmdir($dir));
return $no_errors;
} else {
return $this->_connection->rmdir($dir);
}
}
示例2: rmdir
/**
* Removes an empty directory.
*
* @param string $dir
*
* @return bool
*/
public function rmdir($dir)
{
switch ($this->_connType) {
case SftpHelper::TYPE_SFTP:
default:
$res = $this->_connection->rmdir($dir);
break;
case SftpHelper::TYPE_FTP:
$res = @ftp_rmdir($this->_connection, $dir);
break;
}
return $res;
}
示例3: rmdir
/**
* Attempts to remove the directory named by the path
*
* Removes a directory
*
* NOTE: rmdir() does not have a $recursive parameter as mkdir() does ( http://www.php.net/manual/en/streamwrapper.rmdir.php )
*
* @param String $path
* @param Integer $options
* @return bool
* @access public
*/
public function rmdir($path, $options)
{
$connection = $this->stream_open($path, NULL, NULL, $opened_path);
if ($connection === false) {
return FALSE;
}
$rmdir = $this->sftp->rmdir($this->path);
$this->stream_close();
return $rmdir;
}