PHP Класс phpseclib\Net\SCP

Автор: Jim Wigginton ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$mode integer Mode
$packet_size integer Packet Size
$ssh object SSH Object

Открытые методы

Метод Описание
__construct ( SSH1 | SSH2 $ssh ) : SCP Default Constructor.
_close ( ) Closes the connection to an SSH server
_receive ( ) : string Receives a packet from an SSH server
_send ( string $data ) Sends a packet to an SSH server
get ( string $remote_file, string $local_file = false ) : mixed Downloads a file from the SCP server.
put ( string $remote_file, string $data, integer $mode = self::SOURCE_STRING, callable $callback = null ) : boolean Uploads a file to the SCP server.

Описание методов

__construct() публичный Метод

Connects to an SSH server
public __construct ( SSH1 | SSH2 $ssh ) : SCP
$ssh SSH1 | SSH2
Результат SCP

_close() публичный Метод

Closes the connection to an SSH server
public _close ( )

_receive() публичный Метод

Receives a packet from an SSH server
public _receive ( ) : string
Результат string

_send() публичный Метод

Sends a packet to an SSH server
public _send ( string $data )
$data string

get() публичный Метод

Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the operation
public get ( string $remote_file, string $local_file = false ) : mixed
$remote_file string
$local_file string
Результат mixed

put() публичный Метод

By default, \phpseclib\Net\SCP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. So, for example, if you set $data to 'filename.ext' and then do \phpseclib\Net\SCP::get(), you will get a file, twelve bytes long, containing 'filename.ext' as its contents. Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how large $remote_file will be, as well. Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take care of that, yourself.
public put ( string $remote_file, string $data, integer $mode = self::SOURCE_STRING, callable $callback = null ) : boolean
$remote_file string
$data string
$mode integer
$callback callable
Результат boolean

Описание свойств

$mode публичное свойство

Mode
public int $mode
Результат integer

$packet_size публичное свойство

Packet Size
public int $packet_size
Результат integer

$ssh публичное свойство

SSH Object
public object $ssh
Результат object