rest-full / csv
CSV的文件系统插件。
1.0.0
2023-08-30 02:00 UTC
Requires
- php: >=7.3
- rest-full/filesystem: 1.*
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
或全局安装的composercompser 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许可证许可。