PHP读取或导出Excel
说明
大家需要了解一下PHPExcel是什么?
PHPExcel 就是一个用来操作Office Excel 文档的PHP类库。
代码有注释,就意思上都懂的吧...
目录结构
├── PHPExcel_Croe PHPExcel扩展
├── Export_Excel.php 导出Excel文件
├── Read_Excel.php 读取Excel文件
├── excel_tmp 上传临时文件夹
├── phpexcel.sql 数据库
├── template.xlsx 导出模板文件
├── uploadfile.html 文件上传页面
└── 导入学生信息模板.xlsx
重点
1、读取文件后导入到数据库
2、从数据库导出Excel文件
涉及知识点
1、PHP
2、MySQL
3、PHPExcel扩展
4、文件响应头
帮助文档?
中文站「译」:https://blog.csdn.net/u013291076/article/details/50149653
顺带提醒
PHPExcel 已在2015年停止维护了,所以现在已有更好的代替方案(PhpSpreadsheet:https://github.com/PHPOffice/PhpSpreadsheet)
PhpSpreadsheet打破了兼容性,大大提高了代码库质量(命名空间,PSR合规性,最新PHP语言功能的使用等)
建议新项目使用PhpSpreadsheet
文档地址:https://phpspreadsheet.readthedocs.io/en/latest/
GitHub下载:https://github.com/PHPOffice/PhpSpreadsheet
composer安装:composer require phpoffice/phpspreadsheet