我正在使用 cakephp 的 xlsHelper 以 excel 格式导出。它在所有主要浏览器中都可以正常工作并在除“mac”操作系统之外的所有操作系统中打开文件?
问问题
719 次
1 回答
1
愿这能帮助你..
<?php
$this->layout="";
$filename=strtotime("now");
header ("Expires: 0");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/vnd.ms-excel");
header ("Content-Disposition: attachment; filename=".$filename.".xls");
header ("Content-Description: Generated Report" );
// echo 'Number of Rows::'."\t" . count($test)."\n";
// echo "\n";
echo 'Id' . "\t" .
'EnrollmentId' . "\t" .
'IDS' . "\t" .
'sysreq' . "\t" .
'sysproc' . "\t" .
'Request' . "\t" .
'Response' . "\t" .
'Created' . "\n";
foreach($test as $val):
echo $val['abc']['id']. "\t" .
$val['xyz']['enrollment_id']. "\t" .
$val['bca']['IDS']. "\t" .
$val['mca']['_sysreq']. "\t" .
$val['car']['_sysproc']. "\t" .
$val['azx']['SYSBATCHNO']. "\t" .
$val['tyu']['MSGS']. "\t" .
$val['wer']['created']. "\n";
endforeach;
?>
于 2013-04-09T07:09:26.790 回答