我想获得 ssh2_exec 命令的退出状态。我尝试了以下代码,但它给了我 jar 文件的输出,但我只想要成功或失败的状态。我怎样才能得到它,请帮忙。
$stream = ssh2_exec($connection, 'path of jar file');
stream_set_blocking($stream,true);
$output = ssh2_fetch_stream($stream,SSH2_STREAM_STDIO);
echo stream_get_contents($output);