我正在尝试使用
ssh2_scp_recv($connection, '/remote/directory', '/local/directory');
获取远程目录,但我收到错误:
Warning: ssh2_scp_recv(): Unable to receive remote file in /some-php-file.php on line 2.
如果我使用ssh2_scp_recv获取单个文件,它会起作用。
这个函数应该适用于目录吗?通过阅读文档并不清楚。
答案 0 :(得分:1)
您无法使用ssh2_scp_recv
来获取目录。但是,您可以使用ssh2.sftp://
包装器来使用scandir。
http://php.net/manual/en/wrappers.ssh2.php
Check this gist for an example为要点所有者danielbwa提供代码