如何获取执行命令的返回码:
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
echo $ssh->exec('cat /tmp/file_tmp');
//verify the return code
echo $ssh->exec('echo $?');
?>
echo $?
(Linux) 和echo %errorlevel%
(Win) 不起作用。
有任何想法吗??