$head ="头";
$head1 = date('Y-m-d H:i');
$file_type="vnd.ms-excel"; $file_ending="xls"; header("Content-type:application/text"); //header("Content-Disposition:filename=test.xls"); // 这样可以但不能自动保存 header("Content-Disposition:attachment;filename=$head.$file_ending"); // 这一行为保存可是有错误 header("Pragma: no-cache"); header("Expires: 0"); $now_date = date('Y-m-d H:i'); $title = "数据表($head):生成日期:$head1"; echo("$title\n"); $sep = "\t"; $sep1= " "; print("\n");?><? $query = "select 值0,值1,值2 from table "; ora_parse($cur,$query); ora_exec($cur); $numCols = ora_numcols($cur); for($col=0;$col<$numCols;$col++) { echo ora_columnname($cur,$col).$sep; } print("\n"); while(ora_fetch($cur)) { $strrow = ""; for($i=0;$i<$numCols;$i++) { $temp = ora_getcolumn($cur,$i); str_replace("\t"," ",$temp); str_replace("\'","\"",$temp); $strrow .=$temp.$sep; } $strrow .=$sep1; print(trim($strrow)); print "\n"; }
$head1 = date('Y-m-d H:i');
$file_type="vnd.ms-excel"; $file_ending="xls"; header("Content-type:application/text"); //header("Content-Disposition:filename=test.xls"); // 这样可以但不能自动保存 header("Content-Disposition:attachment;filename=$head.$file_ending"); // 这一行为保存可是有错误 header("Pragma: no-cache"); header("Expires: 0"); $now_date = date('Y-m-d H:i'); $title = "数据表($head):生成日期:$head1"; echo("$title\n"); $sep = "\t"; $sep1= " "; print("\n");?><? $query = "select 值0,值1,值2 from table "; ora_parse($cur,$query); ora_exec($cur); $numCols = ora_numcols($cur); for($col=0;$col<$numCols;$col++) { echo ora_columnname($cur,$col).$sep; } print("\n"); while(ora_fetch($cur)) { $strrow = ""; for($i=0;$i<$numCols;$i++) { $temp = ora_getcolumn($cur,$i); str_replace("\t"," ",$temp); str_replace("\'","\"",$temp); $strrow .=$temp.$sep; } $strrow .=$sep1; print(trim($strrow)); print "\n"; }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货