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.
Return
(array|false) File contents in an array on success, false on failure.
Source
File: wp-admin/includes/class-wp-filesystem-ssh2.php
public function get_contents_array( $file ) { return file( $this->sftp_path( $file ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |