这是原生不需要phpexcel 的简易导出功能
$keys = array('z1, 'z2', 'z3', 'z4', 'z5', 'z6', 'z7'); // excel第一行显示的名称对应key
$keys_chn = array('客户号', '订单号', '订单状态', '产品信息', '订单类型', '件数', '已入库件数');、//key 对应中文
if(!$count){ //列表总数
echo '不存在记录';
exit;
}
$excel_name = "xxxx.xls";
header("Content-type:application/force-download");
header("Content-type:application/vnd.ms-excel;charset='gb2312'");
header("Content-Disposition:attachment; filename=$excel_name");
$sql="select xxx....";
$_list = $_order_data_from_jituan->_list($sql);
echo "excelData==";
echo("");
echo("
");echo("
echo("
");echo("订单信息");
echo("
");echo("
");foreach($keys_chn as $k){
echo("
$k");}
echo("
");$n = count($_list);
for($i=0;$i
{
$r = $_list[$i];
echo("
");foreach($keys as $k){
$r[$k] = str_replace("\"", "", $r[$k]);
echo("
");echo $r[$k];
echo("
");}
echo("
");}
echo("
");echo("");
exit;