WP_Filesystem_SSH2::get_contents()publicWP 2.7.0

Reads entire file into a string.

Method of the class: WP_Filesystem_SSH2{}

No Hooks.

Return

String|false. Read data on success, false if no temporary file could be opened, or if the file couldn't be retrieved.

Usage

$WP_Filesystem_SSH2 = new WP_Filesystem_SSH2();
$WP_Filesystem_SSH2->get_contents( $file );
$file(string) (required)
Name of the file to read.

Changelog

Since 2.7.0 Introduced.

WP_Filesystem_SSH2::get_contents() code WP 6.6.2

public function get_contents( $file ) {
	return file_get_contents( $this->sftp_path( $file ) );
}