PHP code example of cocolait / excel
1. Go to this page and download the library: Download cocolait/excel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cocolait / excel example snippets
composer
// 加载包 如果你使用的框架已经支持自动加载composer了 这行那么就可以省略了
上传文件目录');
// 导出Excel文件
$data = \cocolait\extend\Excel::exportExcel('文件名称','设置Excel表格第一行的显示','需要导出的所有数据');
// Excel转换Array
$data = \cocolait\extend\Excel::excelFileToArray('Excel文件全路径','文件后缀 默认是 xls');