原帖由 chinaunixzcx 于 2009-9-7 22:56 发表
流程很简单
$connect=ssh2_connect("192.168.1.2",22);
ssh2_auth_password($connect,user,pass);
$stream=ssh2_exec($connect, "ls /home");
stream_set_blocking($stream, true);
$output = stream_get_ ...
<?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 ; ?> |
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |