ptachoire / tac
该包已被废弃,不再维护。未建议替代包。
Tac和尾部库。
1.0
2013-11-08 12:18 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2020-07-16 12:26:16 UTC
README
Tac 是一个用于文本文件的 tac 和 tail 的 PHP 实现。
使用方法
如果 /path/to/file contains
包含以下内容
abc
def
ghi
tac()
将返回
$tac = new \Tac\Tac( '/path/to/file' );
var_dump($tac->tac(2));
/*
array(2) {
[0] =>
string(3) "ghi"
[1] =>
string(3) "def"
}
*/
tail()
将返回
$tac = new \Tac\Tac( '/path/to/file' );
var_dump($tac->tail(2));
/*
array(2) {
[0] =>
string(3) "def"
[1] =>
string(3) "ghi"
}
*/
单元测试
phpunit
感谢
文件结构灵感来自 Geocoder,由 William Durand 提供