大家好

最近有用到 SFTP 的需求,特別註記一下
我找到這方案:
也有 github可以使用
require_once __DIR__.DS.'phpseclib'.DS.'loadSFTP.php';//載入 $this->sftp = new Net_SFTP($ftpUrl);//新增連線位置 $this->sftp->login($ftpUser,$ftpPassword);//帳號與密碼 $files = $this->sftp->nlist('./output/');//取得資料列表 $cont = $this->sftp->get('./output/file.txt');//取得檔案
更詳細用法在官方網站中喔
另外我還有遇到這個錯誤:
ssh2_connect(): Error starting up SSH connection(-5): Unable to exchange encryption keys :Error on line 318 in /extdata1/home/wwwroot/pay/pay.php
結果發現是 ssh2 版本問題,只能更新ssh的版本來解決
感謝大家!
留言板
歡迎留下建議與分享!希望一起交流!感恩!