我想使用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
关于php - ssh2_exec wget将不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30941042/