visavi / flystring
系统控制数据以文本格式存储
v1.2
2015-06-20 14:26 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-20 00:26:08 UTC
README
基本实用功能列表
- 读取和检索文本文件中的数据
- 添加和删除行
- 移动、旋转、清除和移动字符串
- 验证输出文件的存在和大小
- 适用于处理CSV格式
<?php // Pass the file name and separator (default |) $fly = new Visavi\FlyString('test.txt', '|'); // Checks the existence of the line returns true or false $string = $fly->exists(); // Returns the number of lines in the file, if the file does not exist returns 0 $string = $fly->count(); // Adding lines to the file, if the file does not exist it will be created, line is added to the file $fly->insert(['hello', 'world', 'test', 555]); // Add a line to the beginning of the file $fly->insert([0, 'The line at the beginning of the', 'something'], false); // Reading the first line of the file, Default shows the last line in the file $string = $fly->read(0); // Search the data in cell number 2, it returns an array of the entire row and line number $string = $fly->search(2, 'test'); // Change the value in the line number 8 and the cell number 2 $fly->cell(8, 2, 'new value'); // Writes a string number 5 new data $fly->update(5, ['hello', 'world', 'test', 555]); // Line breaks down the file number 3, if no number is transferred to a null string $fly->down(3); // Shift 7 line 1 position up, then there would be 7 line 6 and vice versa $fly->shift(7, -1); // Deleting rows from a file, instead of an array can be passed an integer $string = $fly->delete([1, 2]); // Rewrites the entire file when the file does not exist, create it $fly->write('new file'); // Displays formatted file size, such as 543B, 1.43kB $fly->filesize(); // Clears file $fly->clear();
安装
composer require visavi/flystring
许可证
该类是开源软件,采用MIT许可证