在header前面加上 ob_end_clean();
ob_end_clean();//清除缓冲区,避免乱码 header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="订单列表.xls"');