Monthly Archives: 十二月 2011

远程调用SHELL函数

function remoteRunShell($ip, $shell, $sysuser, $syspass) { $connection = ssh2_connect($ip, 22); if(!ssh2_auth_password($connection, $sysuser, $syspass)) { return false; } $stream = ssh2_exec($connection, $shell); stream_set_blocking($stream, true); $output = stream_get_contents($stream); fclose($stream); return $output; }

Posted in 学习笔记 | Leave a comment