## 简介 Excel导入导出都需要它不多说 ## 环境要求 ~~~ InitAdmin >= 201903 PHP >= 5.6 PHP extension php_zip enabled PHP extension php_xml enabled PHP extension php_gd2 enabled ~~~ ## 安装扩展 ``` cd actionphp/vendor composer require phpoffice/phpspreadsheet ``` ## 基本用法 ``` $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Hello World !'); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); $writer->save('hello world.xlsx'); ``` ## 英文文档地址 https://phpspreadsheet.readthedocs.io/en/latest/