First you need to download the Phpexecel class file, the Help document can refer to phpexcel Chinese help manual | Phpexcel how to use it.
The following directly on the example, is I write a simple batch export data for Excel example
Front page is relatively simple, is a hyperlink, jump to the processing page, hyperlinks can also be with some parameters (see requirements)!
<a href= "./process1.php" > Export Excel Table </a>
Background process.php page
Expexcel (, ' phpexcel.php ' =->getproperties ()->setcreator ("Zxf")->setlastmodifiedby ("ZXF")- >settitle (' Data Excel export ')->setsubject (' Data Excel export ')->setdescription (' Export Data ')->setkeywords (" Excel ")->setcategory (" Result file "); ->setactivesheetindex (0->->setcellvalue (' A1 ', ' owner name '->setcellvalue (' B1 ', ' Password '->setcellvalue (' C1 '), ' Mobile number '->setcellvalue (' D1 ', ' Address '->getstyle (' a1:d1 ')->getfont ()->getcolor ()->setargb (phpexcel_ Style_color:: = 1 (++->->setcellvalue (' A '., [' Name '->setcellvalue (' B '), [' pwd '->setcellvalue (' C '., [' Phone '->setcellvalue (' D '., [' Address '->setactivesheetindex (0 (' content-type:application/vnd.ms-excel '); (' Content-disposition:attachment;filename= '. XLS "'); (' Cache-control:max-age=0 ' (' content-type:text/html; Charset=utf-8 '); = Phpexcel_iofactory::createwriter (, ' Excel5 '); ->save (' Php://output ' ("Content-type:text/html;charset=utf-8") = @ (' localhost ', ' root ', ') or (' Connection database failed ' (' Test ', (' set names UTF8 ' = "select * from House" = (= (= (= (= [] = "User table" Expexc El (,)
Use Phpexcel to export data to this end, for use Phpexcel import to the database can see Using PHPEXCEL implementation data batch upload to the database