开发者

Is there an SFTP library for CodeIgniter?

I 开发者_StackOverflow中文版know there is a default FTP Library Class, but it doesn't work with SFTP


Personally, I'd recommend phpseclib, a pure PHP SFTP implementation. It has no external dependancies, unlike the PHP ssh2 library extension Femi recommended and it's a ton more versatile than cURL.


If you download phpseclib, you can put it in the third_party folder and create a simple library using :

    set_include_path(APPPATH . '/third_party/phpsec');
require_once APPPATH."/third_party/phpsec/Net/SFTP.php"; 
class Sftp {  }

Which then it's just like all other libraries that you can use wherever in your Codeigniter app.


Take a look at http://codeigniter.com/forums/viewthread/156139/. It uses the PHP ssh2 library extension (see http://www.php.net/manual/en/function.ssh2-sftp.php, with the overview at http://www.php.net/manual/en/book.ssh2.php).

Or do it with cURL: previously mentioned at SFTP from within PHP.

But no, there is no CI class library that does SFTP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜