radnan/rdn-csv
最新稳定版本:v3.0.0
Composer 安装命令:
composer require radnan/rdn-csv
包简介
Laminas module to export and import CSV files
README 文档
README
The RdnCsv Laminas module makes it really easy to export and import CSV files.
How to install
-
Use
composerto require theradnan/rdn-csvpackage:$ composer require radnan/rdn-csv:3.* -
Activate the module by including it in your
application.config.phpfile:<?php return array( 'modules' => array( 'RdnCsv', // ... ), );
How to use
The module comes with two plugins - CsvExport() and CsvImport().
CsvExport()
Export data into a downloadable CSV file using this plugin.
// inside a controller action $header = array( 'Year', 'Make', 'Model', 'Description', 'Price', ); $records = array( array( '1997', 'Ford', 'E350', 'ac, abs, moon', '3000.00', ), ); return $this->CsvExport('foo.csv', $header, $records);
The plugin will return a response object which you can then return from your controller action.
Read more documentation on CsvExport()
CsvImport()
Import data from a CSV file using this plugin.
// inside a controller action $csv = $this->CsvImport('/path/to/foo.csv'); foreach ($csv as $row) { var_dump($row); // array( // 'Year' => '1997', // 'Make' => 'Ford', // 'Model' => 'E350', // 'Description' => 'ac, abs, moon', // 'Price' => '3000.00', // ) }
The plugin returns an iterator that can be used to loop over all the rows in the CSV file.
统计信息
- 总下载量: 115.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-26