Save the database query results to Excel. Excel can easily process data. if the database data can be read into an excel file, it can be easily processed. Convert database data to Excel excel. php? Phpcla Excel can easily process data. if the database data can be read into an excel file, it can be easily processed.
Convert database data to Excel excel. php
wirtetoexcel($path,$data); } function wirtetoexcel ($fn,$data) { $fp=fopen($fn,"wb"); fwrite($fp,$data); fclose($fp); }}?>
Create an object of this class, and then call the method of this object to export database data to Excel.
start();?>
companyname_cn |
companyname_en" |
name |
position |
tel |
fax |
email |
website |
product |
|
|
|
|
|
|
|
|
|
save("Excel/data.xls"); ?>
The key code is actually a few lines:
// Contains the class file include_once ("excel. php "); // Create an excel class object $ Excel = new Excel (); // call the start () method of the object $ Excel-> start (); // call the save () file of the object to claim the excel file. $ Excel-> save ("Excel/data.xls ");
Bytes. Convert database data to Excel excel. php? Phpcla...