PHP-ssh2读取输出流

PHP-ssh2读取输出流,php,ssh,Php,Ssh,我无法在PHP中显示SSH流的输出。这是我的代码: $output = ssh2_exec($sshCon, $sshCommand); stream_set_blocking($output, true); echo stream_get_contents($output); 输出为空。不过命令肯定正在运行。我还尝试了这里给出的解决方案: 输出应该是进程ID,只是为了让您知道 谢谢 试试看: 试试: <?php include('Net/SSH2.php'); $ssh

我无法在PHP中显示SSH流的输出。这是我的代码:

$output = ssh2_exec($sshCon, $sshCommand);

stream_set_blocking($output, true);

echo stream_get_contents($output);
输出为空。不过命令肯定正在运行。我还尝试了这里给出的解决方案:

输出应该是进程ID,只是为了让您知道

谢谢

试试看:


试试:


<?php
include('Net/SSH2.php');

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}

echo $ssh->exec($sshCommand);
?>