dtr / ssh
dTR-SSH 是一个 SSHv2 库
dev-master / 0.8.2.x-dev
2013-10-23 18:20 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-14 14:50:48 UTC
README
dTR-SSH 是 PHP 中 SSH 函数的包装类。它旨在管理 OpenSSH2 和 net-sshd 守护进程的阻塞/非阻塞,以便管理响应,并允许以 OOP 接口在其他项目中使用。
示例
use dTR\Networking;
$options = array(
'host' => $remote_host,
'port' => '22',
'auth' =>
array(
'type' => SSH::PASS,
'username' => 'admin',
'password' => '',
)
);
try{
$ssh = new SSH($options);
$ssh->connect();
if($ssh->authenticate()){
echo $ssh->exec('ls -la');
}
$ssh->disconnect();
}
catch(\Exception $e){
echo $e->getMessage();
}