php 导出Excel2007如何实现 弹出另存为对话框? 代码是?
用了如下代码:不行,没有弹出,我是点导出按钮要实现弹出另存对话框,出现excel表格的!header('Content-Type:application/vnd.open...
用了如下代码:不行,没有弹出,我是点导出按钮要实现弹出另存对话框,出现excel表格的!
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="01simple.xlsx"');
// header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output'); 展开
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="01simple.xlsx"');
// header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output'); 展开
2个回答
展开全部
$msg ="1,2,3,4\n";
$msg .="1,2,3,4\n";
header("Pragma: cache");
header("Content-Disposition: attachment; filename=\"cdr4.csv\"");
header("Content-Type: text/csv; charset=utf8");
header( "Expires: ". strftime("%a,%d %b %Y %H:%M:%S %Z",strtotime("+2 day")) );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($msg));
echo $msg;
exit();
$msg .="1,2,3,4\n";
header("Pragma: cache");
header("Content-Disposition: attachment; filename=\"cdr4.csv\"");
header("Content-Type: text/csv; charset=utf8");
header( "Expires: ". strftime("%a,%d %b %Y %H:%M:%S %Z",strtotime("+2 day")) );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($msg));
echo $msg;
exit();
更多追问追答
追问
您好,首先谢谢您,但是我要导出的是excel2007已经可以生成了。。但是点击导出没有出现另存框!现在的问题是如何让excel导出出现另存为对话框?
追答
那就不了解了
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询