linyuee / excel
excel导出工具包
Installs: 57
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/linyuee/excel
Requires
- php: >=5.5
 - linyuee/core: 1.0.*
 - phpoffice/phpexcel: ^1.8
 
This package is not auto-updated.
Last update: 2025-11-03 12:39:06 UTC
README
1、安装
composer require linyuee/excel
2、使用
导出数据
//导出的数据
$data = array(
            ['id'=>1,'username'=>'test1','phone'=>'18881515151'],
            ['id'=>2,'username'=>'test2','phone'=>'18881515152'],
            ['id'=>3,'username'=>'test3','phone'=>'18881515153'],
        );
//标题
$sheettitle = array(  
            'id'=>'ID',
            'username'=>'答题人',
            'phone'=>'联系方式',
        );
//导出的数据和标题数组的key要一致
$excel = new \Linyuee\Excel\Export();
        $excel->setData($data)
            ->setFileName('问卷答题情况')
            ->setTitle($sheettitle)
            ->setStartIndex('B')
            ->setFileExt('csv')  //目前支持csv,xls,xlsx
            ->export();        
读取文件数据
$excel = new \Linyuee\Excel\Import();
        $data = $excel->setPath('/disk2/123.xlsx')->read();
        var_dump($data);