gf2007/excel

1.0.2 2019-07-10 05:59 UTC

This package is auto-updated.

Last update: 2024-09-22 13:03:17 UTC


README

简单地将PHP数组导出为Excel

通过PHP数组实现的普通Excel导出器和导入器

✨ 特点

  • 轻松将数组导出到Excel 极简地将数组转换为Excel
  • 可选添加行标题或不添加 可选择是否添加行标题
  • Excel文件直接输出到浏览器 Excel文件直接输出到浏览器

导出器 导出

<?php

use gerfin\excel\Exporter;

$exporter = new Exporter();
/**
 * @param array $data 源数据 required
 * @param array $header 行标题 optional
 * @param string $excelName excel名称 optional
 * @param string $format 格式xls或xlsx optional
 * @param string $sheetName sheet名称 optional
 * @throws \PhpOffice\PhpSpreadsheet\Exception
 */
$exporter->export([["1","jack"],["2", "nancy"]], ["id", "name"], "excelName", "xls", "sheetName");