function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
}
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
}
function xlsWriteLabel($Row, $Col, $Value) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
}
ob_end_clean();
ob_clean();
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header('Content-Type: application/vnd.ms-excel; charset=utf-8');
header("Content-Transfer-Encoding: binary");
$filename = urlencode('export_'.date("Y-m-d-His").'.xls');
header("Content-Disposition: attachment; filename='.$filename.'");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
header("Pragma: public");
xlsBOF();
xlsWriteLabel(0, 0, "中文好");
xlsWriteLabel(0, 1, "中文妙");
xlsWriteLabel(0, 2, "中文第一");
$order = $pdo->query(
"SELECT * FROM `order_record` as r "
);
$i = 1;
while ($row = mysqli_fetch_array($order)) {
xlsWriteNumber($i, 0, 230);
xlsWriteLabel($i, 1, "John");
xlsWriteLabel($i, 2, "john@yahoo.com");
$i++;
}
xlsEOF();
这是我的代码我有找一些方法放上去仍然是乱码就像这样这是啥问题?
然后每次打开都会有这个视窗但明明就是有数据的呀
添加回答
举报
0/150
提交
取消