我一直在尝试在此库中包含的样本excel中导出相同的数据:
并且我得到了一些像这样的奇怪输出:
为什么,哦为什么......这里是我的代码:
<?php
include_once("header.auth.php");
require_once "xlsstream/excel.php";
$fecha_de_corrido=date("YmdHi");
$export_file = "xlsfile://tmp/InformeCertificados_".$fecha_de_corrido.".xls";
$fp = fopen($export_file, "wb");
if (!is_resource($fp))
{
die("Cannot open $export_file");
}
$assoc = array(
array("Sales Person" => "Sam Jackson", "Q1" => "$3255", "Q2" => "$3167", "Q3" => 3245, "Q4" => 3943),
array("Sales Person" => "Jim Brown", "Q1" => "$2580", "Q2" => "$2677", "Q3" => 3225, "Q4" => 3410),
array("Sales Person" => "John Hancock", "Q1" => "$9367", "Q2" => "$9875", "Q3" => 9544, "Q4" => 10255),
);
fwrite($fp,serialize($assoc));
fclose($fp);
header ("Content-type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"" . basename($export_file) . "\"" );
header ("Content-Description: PHP/INTERBASE Generated Data" );
readfile($export_file);
exit;
?>
Plz任何帮助都会很棒。