0

我尝试为每个 PHP SSH2 创建一个包含内容的 txt 文件。

这是我试过的代码:

include('Net/SSH2.php');

$ssh = new Net_SSH2('MYIP');
if (!$ssh->login('root', 'MYPASS')) {
    exit('Login Failed');
}

if($ssh->exec('cd /var/test/')){
    echo $ssh->exec('sudo sh -c \'"text\r\ntest1\r\ntest2" > test.txt\'');
}

unset($ssh);

有没有办法做到这一点?

4

0 回答 0