2017-09-25 183 views
0

我使用phpseclib来访问我的SSH屏幕。它适用于下面的代码,除非我不能显示超过17行(40会很好)。 我尝试了不同的方法,例如在File/ANSI.php文件中更改定义,但没有成功。使用phpseclib显示超过17行交互式shell

可以使用phpseclib文件来完成,还是我必须在我的(linux/debian)服务器上进行修改?

我的文件:

<?php 
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib'); 
include('Net/SSH2.php'); 
include('File/ANSI.php'); 

$ssh = new Net_SSH2('111.222.33.44'); 
if (!$ssh->login('user', 'passwd')) { 
    exit('Login Failed'); 
} 

$ansi = new File_ANSI(); 

$ssh->write("screen -r 27015\n"); 
$ssh->setTimeout(1); 
$ansi->appendString($ssh->read()); 
echo $ansi->getScreen(); // outputs HTML 
?> 
+0

占有你只尝试过这种'回声$ SSH->阅读() ' –

+0

空白页。代码很好,效果很好,它来自:http://phpseclib.sourceforge.net/ssh/examples.html。我只想显示更多的线条。 – Robg

+0

也许你错过了这一行'$ ansi-> appendString($ ssh-> read('username @ username:〜$'));' –

回答

0

最后,我能够通过修改网/ SSH2.php添加行:

var $windowRows = 24;