nbish11 / fileinfo
为不支持PHP的finfo类的那些人提供了一个FileInfo类。
v1.0.0
2016-07-14 21:03 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- codeclimate/php-test-reporter: ^0.3.2
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-08-29 04:19:54 UTC
README
提供围绕PHP的pathinfo方法的一个简单且灵活的API包装器。
安装
安装此包的推荐方法是使用Composer
$ composer require nbish11/fileinfo
基本用法
<?php require 'vendor/autoload.php'; $finfo = new FileInfo('C:/path/to/file.txt'); // Using standard API methods: echo $finfo->getDirectory(); // 'C:/path/to/' echo $finfo->getBaseName(); // 'file.txt' echo $finfo->getExtension(); // 'txt' echo $finfo->getFileName(); // 'file' echo $finfo->getMimeType(); // 'text/plain' // Using class properties: echo $finfo->directory; // 'C:/path/to/' echo $finfo->basename; // 'file.txt' echo $finfo->extension; // 'txt' echo $finfo->filename; // 'file' echo $finfo->mimetype; // 'text/plain'
贡献
请参阅CONTRIBUTING。
许可协议
版权所有 © 2016 Nathan Bishop
有关更多信息,请参阅LICENSE。