我想使用ssh2_exec下载文件。
像xdotool这样的东西可以工作,但是wget / pkill却不能。
这是代码
function __construct($host, $user, $pw, $port) {
$this->SSHC = ssh2_connect($host, 22);
ssh2_auth_password($this->SSHC, $user, $pw);
}
function downloadFile() {
ssh2_exec($this->SSHC, "wget http://path/to/file");
}
请您参考如下方法:
我不知道这是否仍然需要,但是看来问题与wget的输出某种程度上有关。如果使用后台选项运行wget,则一切正常:wget -b /path/to/file




