1) Demo
$titles=Array(' Order number ', ' Commodity Settlement code ', ' contract number ', ' Supplier name ', ' counter ', ' Product name ', ' Commodity item number ', ' commodity price ', ' commodity price ', ' Supplier settlement amount ', ' quantity of goods ', ' product promotion offer ', ' Platform discount ', ' Brand Order discount ');//Export PreparationOb_get_clean();Ob_start();Echo implode("\ T",$titles), "\ n";$currencyModel= App::get (' ECtools ')->model (' Currency '));foreach($lists as $key=$value) { $row=Array(); $row[' order_id '] =Html_entity_decode("".$value[' order_id ']); $row[' supplier_num '] =$value[' Supplier_num ']; $row[' agreement_code '] =$value[' Agreement_code ']; $row[' supplier_name '] =$value[' Supplier_name ']; $row[' shoppe_name '] =$value[' Shoppe_name ']; $row[' name '] =$value[' Name ']; $row[' bn '] =$value[' Bn ']; $row[' price '] =$value[' Price ']; $row[' nums '] =$value[' Nums ']; $row[' g_price '] =$value[' G_price ']; $row[' settlement_amount '] =$value[' Settlement_amount ']; $row[' goods_amount_off '] =$value[' Goods_amount_off ']; $row[' amount_off '] =$value[' Amount_off ']; $row[' brand_amount_off '] =$value[' Brand_amount_off ']; Echo implode("\ T",$row), "\ n";}Header(' Content-disposition:attachment; Filename= '.$filename);Header(' Accept-ranges:bytes ');Header(' Content-length: '.Ob_get_length());Header(' Content-type:application/vnd.ms-excel ');Ob_end_flush();
2) Format selection
If you need to export XLS, use
Header (' Content-type:application/vnd.ms-excel ');
If you need to export xlsx, use
Header (' Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ');
The difference between XLS and xlsx is the problem of storing data size, XLS can only save about 5, 6w data, xlsx can be about 100w
3) long digital full display solution
$row [' order_id '] Html_entity_decode ("". $value [' order_id ']);
is to first spell the HTML special character , and then turn back to the meaning
PS: This is the way to get back from the Phpexcel.
I copied the phpexcel generated numbers into the TXT file and explained what it was, and then I found this thing.
PHP exports Excel (xls or xlsx) (resolves long digital display issues)