很简单,通过file_exists
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$_sftp = ssh2_sftp($connection);
if (file_exists('ssh2.sftp://' . $_sftp . "/www/index.html")) {
echo "存在";
}
?>
网友回复