Gaufrette PHP文件系统抽象层开源项目

我要开发同款
匿名用户2013年12月31日
34阅读
开发技术PHP
所属分类程序开发、常用工具包
授权协议MIT

作品详情

Gaufrette提供了一个文件系统的抽象层的PHP5库。它使得以相同方式操控本地文件,FTP服务器,亚马逊S3等等。它允许你开发程序时,不用了解未来你将怎么访问你的文件。

示例代码:

<?phpuse Gaufrette\Filesystem;use Gaufrette\Adapter\Ftp as FtpAdapter;use Gaufrette\Adapter\Local as LocalAdapter;use Gaufrette\Adapter\Cache as CacheAdapter;// Locale Cache-Directory (e.g. '%kernel.root_dir%/cache/%kernel.environment%/filesystem') with create = true$local = new LocalAdapter($cacheDirectory, true);// FTP Adapter with a defined root-path$ftp = new FtpAdapter($path, $host, $username, $password, $port);// Cached Adapter with 3600 seconds time to live$cachedFtp = new CacheAdapter($ftp, $local, 3600);$filesystem = new Filesystem($cachedFtp);
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论