Baidu Phpexcel
After entering
Select Branches to enter Select version copy classes file renamed to Phpexcel
Here's a simple export I wrote with thinkphp3.2.3
Public Function Phpexcel () {
$path =str_replace (' \ \ ', '/', __file__);//
$arr =explode ('/', $path);
$STR = $arr [0]. ' /'. $arr [1]. ' /'. $arr [2]. ' /'. $arr [3]. ' /';//Assemble file path
$a = $str. ' public/home/phpexcel/';//define the path where the Phpexcel file is located
$b = $str. '/public/home/xlsx/'; Export Data path
Require $a. ' phpexcel.php '; Import Phpexcel File
Instantiate the Phpexcel class
$objPHPexcel = new \phpexcel ();
Gets the action object for the currently active sheet
$objSheet = $objPHPexcel->getactivesheet ();
Set a name for the current activity sheet
$objSheet->settitle (' demo ');
Populate data for the current activity sheet
/*
$objSheet->setcellvalue (' A1 ', ' name ')->setcellvalue (' B1 ', ' fractions ');//Line
$objSheet->setcellvalue (' A2 ', ' John Doe ')->setcellvalue (' B2 ', ' 20 ');//Column
$objSheet->setcellvalue (' A3 ', ' Harry ')->setcellvalue (' B3 ', ' 80 ');//Column
Generate an Excel file in the specified format
$objWriter =\phpexcel_iofactory::createwriter ($objPHPexcel, ' Excel2007 ');
$objWriter->save ($b. ' demo_2.xlsx ');
*/
$array = Array (
Array (' name ', ' score '),
Array (' John Doe ', ' 40 '),
Array (' Harry ', ' 60 '),
Array (' Zhao Liu ', ' 80 ')
);
$objSheet->fromarray ($array);
$objWriter =\phpexcel_iofactory::createwriter ($objPHPexcel, ' Excel2007 ');
$objWriter->save ($b. ' demo_3.xlsx ');
}
Phpexcel Exporting data