GC_Filesystem_ftpsockets::exists()

最后更新于:2021-11-27 19:07:06

GC_Filesystem_ftpsockets::exists( string$file)

Checks if a file or directory exists.

参数

$file

(string) (Required) Path to file or directory.

响应

(bool) Whether $file exists or not.

源文件

文件: gc-admin/includes/class-gc-filesystem-ftpsockets.php

	public function exists( $file ) {
		$list = $this->ftp->nlist( $file );

		if ( empty( $list ) && $this->is_dir( $file ) ) {
			return true; // File is an empty directory.
		}

		return ! empty( $list ); // Empty list = no file, so invert.
		// 响应 $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
	}