CSV的文件系统插件。

1.0.0 2023-08-30 02:00 UTC

This package is auto-updated.

Last update: 2024-09-30 01:41:18 UTC


README

关于CSV

CSV的文件系统插件。

安装

  • 下载Composer或更新composer self-update
  • 运行php composer.phar require rest-full/csv或全局安装的composer compser require rest-full/csv或composer.json "rest-full/csv": "1.0.0"并安装或更新。

使用

导出

<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config/pathServer.php';

use Restfull\CommaSeparatedValues\CommaSeparatedValues;

try {
   $csv = new CommaSeparatedValues('contacts.csv');
   //the $positions variable can contain the initial and columns keys to tell which line to start those positions.
   $positions = ['initial' => 3, 'columns' => [ 2, 3]];
   //or the $positions variable can't contain the initial and columns keys to tell which line to start those positions.
   $positions = [0, 1];
   var_dump($csv->reading($positions));
} catch (\Restfull\Error\Exceptions $e) {
   echo $e->getMessage();
}

导入

<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config/pathServer.php';

use Restfull\CommaSeparatedValues\CommaSeparatedValues;

try {
    $csv = new CommaSeparatedValues('contacts.csv');
    var_dump($csv->writing(['casa' => 0, 'mae' => 1]));
} catch (\Restfull\Error\Exceptions $e) {
    echo $e->getMessage();
}

许可证

该csv是开源软件,受MIT许可证许可。