vdbf/import-php
Composer 安装命令:
composer require vdbf/import-php
包简介
Simple importer written in PHP >= 5.3
README 文档
README
Simple importer written in PHP
Example
<?php /** * Excel sheet example: * | A | B | C | * | 1 | 2 | 3 | * | 4 | 5 | 6 | */ $path = 'path/to/file.xlsx'; $importer = new Vdbf\Import\Excel\SingleSheetImporter(new Vdbf\Import\Excel\Reader()); //importer closure is called for every data-row $importer->import($path, function ($row, $header) { print_r($header); //['A', 'B', 'C'] print_r($row); //[1, 2, 3] }); //importer dump method dumps all rows to a 2D associative array $dump = $importer->dump($path); print_r($dump) //[['A' => 1, 'B' => 2, 'C' => 3], ['A' => 4, 'B' => 5, 'C' => 6]]
Configuration
The importer can be constructed with an array of options as a second argument.
<?php $options = [ 'read_header' => false, //skips reading the first row as a header row, defaults to true 'sheet_index' => 1 //imports the second sheet, defaults to 0 ]; $importer = new Vdbf\Import\Excel\SingleSheetImporter(new Vdbf\Import\Excel\Reader(), $options); ...
统计信息
- 总下载量: 137
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-05