array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.ssh2-sftp.php', 1 => 'ssh2_sftp', ), 'up' => array ( 0 => 'ref.ssh2.php', 1 => 'SSH2 Funktionen', ), 'prev' => array ( 0 => 'function.ssh2-sftp-unlink.php', 1 => 'ssh2_sftp_unlink', ), 'next' => array ( 0 => 'function.ssh2-shell.php', 1 => 'ssh2_shell', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ssh2/functions/ssh2-sftp.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ssh2 >= 0.9.0)
ssh2_sftp — Initialize SFTP subsystem
Request the SFTP subsystem from an already connected SSH2 server.
This method returns an SSH2 SFTP
resource for use with
all other ssh2_sftp_*() methods and the
ssh2.sftp:// fopen wrapper,
Bei einem Fehler wird false
zurückgegeben..
Beispiel #1 Opening a file via SFTP
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$stream = fopen('ssh2.sftp://' . intval($sftp) . '/path/to/file', 'r');
?>