本文整理汇总了PHP中Net_SSH2::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SSH2::reset方法的具体用法?PHP Net_SSH2::reset怎么用?PHP Net_SSH2::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_SSH2
的用法示例。
在下文中一共展示了Net_SSH2::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exec
public function Exec($command, $stdin = '')
{
$database = $this->session->getDatabase();
$name = $database['name'];
$engine = $this->session->getSpoolerByName($name, 'waae');
if (!isset($engine[0]['shell'])) {
print "?!";
exit;
}
set_include_path('../vendor/phpseclib' . PATH_SEPARATOR . get_include_path());
include 'Net/SSH2.php';
include 'Crypt/RSA.php';
$shell = $engine[0]['shell'];
$host = $shell['host'];
$user = $shell['user'];
$ssh = new \Net_SSH2($host);
if (isset($shell['key'])) {
$key = new \Crypt_RSA();
$ret = $key->loadKey($shell['key']);
if (!$ret) {
echo "loadKey failed\n";
print "<pre>" . $ssh->getLog() . '</pre>';
exit;
}
} elseif (isset($shell['password'])) {
$key = $shell['password'];
} else {
$key = '';
// ?! possible ?
}
if (!$ssh->login('autosys', $key)) {
print 'Login Failed';
print "<pre>" . $ssh->getLog() . '</pre>';
exit;
}
if ($stdin == '') {
return $ssh->exec(". ~/.bash_profile;{$command}");
}
// Test STDIN
$ssh->enablePTY();
print "profile" . $ssh->exec(". ~/.bash_profile");
print "sort" . ($exec = $ssh->exec('sort'));
$ssh->write(<<<EOF
echo "update_job: SE.ERIC.JOB.JobType_UNIX"
echo "description: 'ok!!'
EOF
);
$ssh->reset(true);
$ssh->setTimeout(2);
print $ssh->read();
return;
return $ssh->read();
// outputs the echo above
}