如果我尝试以下命令:
$_content = file_get_contents("ssh2.sftp://".intval($sftp)."/Lorem-62398848890105_20190117-101229.txt");
它有效,我得到了正确的内容。但是每当我想拥有远程文件夹的所有文件时,都无法打开该目录。
我试过scandir或opendir。这两个都提出了这个信息:
Warning: scandir(): Unable to open ssh2.sftp://12/ on remote host
我做错了什么?一些提示真的会帮助我。
问候
上下文:我使用 PHP 7.0.32 并且 ssh2.so 已完全安装
更新:我明白了。我认为这是由于提供者的错误态度造成的。这个怎么运作:
$handle = opendir("ssh2.sftp://".intval($sftp).ssh2_sftp_realpath($sftp,".").'./');
函数ssh2_sftp_realpath + ' ./ ' 可以解决问题。