WP_Filesystem_SSH2::get_contents_array() WordPress Method

The WP_Filesystem_SSH2::get_contents_array() method is used to get the contents of a file on a remote server over an SSH connection. This is useful for retrieving data from files that are not publicly accessible. The method takes two parameters: the file path and an optional array of args. The file path is the path to the file on the remote server. The args array can be used to set options for the method, such as setting the return type to an array or a string.

WP_Filesystem_SSH2::get_contents_array( string $file ) #

Reads entire file into an array.


Parameters

$file

(string)(Required)Path to the file.


Top ↑

Return

(array|false) File contents in an array on success, false on failure.


Top ↑

Source

File: wp-admin/includes/class-wp-filesystem-ssh2.php

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


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.