xy2z/philer

处理单个文件操作

0.3.1 2017-11-25 21:32 UTC

This package is auto-updated.

Last update: 2024-09-29 05:08:02 UTC


README

安装

使用 Composer 安装最新版本 Composer。需要 PHP 7.0 或以上版本。

$ composer require xy2z/philer

基本用法

use xy2z\Philer\Philer;

$philer = new Philer('list.txt');
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
echo $philer->read();
/* Result:
3.14
Array
(
    [0] => a
    [1] => b
    [2] => c
)
*/


// Load a new file and change options
$philer->load('new-list.txt');
$philer->set_option('var_dump', true);
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
/* Result in 'new-list.txt':
float(3.14)
array(3) {
  [0]=>
  string(1) "a"
  [1]=>
  string(1) "b"
  [2]=>
  string(1) "c"
}
*/

选项