【发布时间】:2013-12-13 22:04:02
【问题描述】:
我正在使用 php ssh2_scp_send 将文件传输到远程机器,但这有点奇怪,它第一次工作但我的第二次调用失败并出现以下错误
//success for file transfer
if (!(ssh2_scp_send($this->conn, $lpath, $rpath, 0777))){
throw new Exception("File transfer failed!");
}
ssh2_exec($this->conn, 'exit');
//fail this time
if (!(ssh2_scp_send($this->conn, $lpath, $rpath, 0777))){
throw new Exception("File transfer failed!");
}
ssh2_exec($this->conn, 'exit')
“警告:ssh2_scp_send(): 在 /var/www/trunk/rsetting/class/ssh.class.php 第 57 行复制文件失败”
任何帮助将不胜感激~谢谢
【问题讨论】:
-
因为你在第一次传输后关闭了连接..
ssh2_exec($this->conn, 'exit'); -
感谢您的评论,我已删除该代码,但问题仍然存在 :(
-
是的,完全一样的错误