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

TP5 Excel export download convenient class library

PHP中文网
PHP中文网Original
2017-09-01 16:38:461317browse

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);


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!

Statement:
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