FtpClient\FtpClient::remove PHP Метод

remove() публичный Метод

Remove a file or a directory.
См. также: FtpClient::rmdir()
См. также: FtpClient::cleanDir()
См. также: FtpClient::delete()
public remove ( string $path, boolean $recursive = false ) : boolean
$path string The path of the file or directory to remove
$recursive boolean Is effective only if $path is a directory, {@see \FtpClient::rmdir()}
Результат boolean
    public function remove($path, $recursive = false)
    {
        try {
            if (@$this->ftp->delete($path) or $this->isDir($path) and @$this->rmdir($path, $recursive)) {
                return true;
            }
            return false;
        } catch (\Exception $e) {
            return false;
        }
    }

Usage Example

Пример #1
0
 public function uploadFile($localPath)
 {
     $file = "/" . $this->environment . "/" . self::APP_NAME . "/" . self::FILE_NAME;
     $this->connection->remove($file);
     $this->connection->put($file, $localPath, FTP_BINARY);
 }