<?php
$connect=ssh2_connect("www.superserver.com",22);
ssh2_auth_password($connect,'HonestQiao','123456');
$stream=ssh2_exec($connect, "cd /usr;ls;");
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);
fclose($stream);
echo $output ;
?>
结果如下:
---------- PHP5 代码调试 ----------
bin
compat
db
games
home
include
lib
libdata
libexec
local
obj
ports
sbin
share
src
输出完成 (耗时 3 秒) - 正常终止
$connect=ssh2_connect("www.superserver.com",22);
ssh2_auth_password($connect,'HonestQiao','123456');
$stream=ssh2_exec($connect, "cd /usr;ls;");
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);
fclose($stream);
echo $output ;
?>
结果如下:
---------- PHP5 代码调试 ----------
bin
compat
db
games
home
include
lib
libdata
libexec
local
obj
ports
sbin
share
src
输出完成 (耗时 3 秒) - 正常终止