GC_Filesystem_FTPext::exists()

最后更新于:2021-11-27 18:46:24

GC_Filesystem_FTPext::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-ftpext.php

	public function exists( $file ) {
		$list = ftp_nlist( $this->link, $file );

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

		return ! empty( $list ); // Empty list = no file, so invert.
	}