Home > Backend Development > PHP Tutorial > TP5 Excel export download convenient class library

TP5 Excel export download convenient class library

PHP中文网
Release: 2023-03-15 17:14:01
Original
1308 people have browsed it

TP5 Excel export download project references PHPExcel1.8
The controller class calling method supports chain operations
Quickly export Excel
You only need to define the display fields and query conditions to be downloaded
Support multiple tables output to one EXCEL

$excel=new Excel();
$table_name="mk_material_list_edit";
$field=["id"=>"序号","guid"=>"项目代码","name"=>"项目名称"];
$map=["status"=>1];
$map2=["status"=>-1];
$excel->setExcelName("下载装修项目")
->createSheet("装修项目",$table_name,$field,$map)
->createSheet("已删除装修项目",$table_name,$field,$map2)
->downloadExcel();
//快速导入
$getExcelobject=Excel::loadExcel("test.xls");
$sheetName=$getExcelobject->getSheetNames();
dump($sheetName);
$sheet = $getExcelobject->getSheetByName($sheetName[0])->toArray();
dump($sheet);
Copy after login


The above is the detailed content of TP5 Excel export download convenient class library. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template