php导出excel
来源:互联网 发布:besiege mac 下载 编辑:程序博客网 时间:2024/04/30 10:43
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
header("Expires: 0");
echo "1/t2/t3/t4/t/n";
echo "11/t22/t33/t44/t/n";
?>
<?php
$file_type = "vnd.ms-excel";
$file_ending = "xls";
header("Content-Type: application/$file_type");
header("Content-Disposition: attachment; filename=export_file.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");
$sql="select * from table where ..;
$dbresult=dbx_query($db_link,$sql);
$sep = "/t";
$name[0]="收据编号";
$name[1]="收款人";
$name[2]="备注";
$name[3]="付款方式";
$name[4]="金额";
$name[5]="日期";
for ($i = 0; $i <6; $i++) {
echo $name[$i] . "/t";
}
print("/n");
for($for_index=0;$for_index<$dbresult->rows;$for_index++){
$schema_insert = "";
$tpl_shoujuhao=$dbresult->data[$for_index][0];
$tpl_shoukuansid=$dbresult->data[$for_index][1];
$tpl_mark=$dbresult->data[$for_index][2];
$tpl_paytype=$dbresult->data[$for_index][3];
$tpl_mark=iconv("utf-8","gb2312",$tpl_mark);//将utf-8转换为gb2312
for($j=0; $j<6;$j++){
if($dbresult->data[$for_index][$j]!=""){
if($j==0){
$schema_insert .= $tpl_shoujuhao.$sep;
}
else if($j==1){
$schema_insert .= $tpl_shoukuan.$sep;
}
else if($j==2){
$schema_insert .= $tpl_mark.$sep;
}
else if($j==3){
$schema_insert .= $tpl_show_paytype.$sep;
}
}
else $schema_insert .= "".$sep;
}
$schema_insert = str_replace($sep."$", "", $schema_insert);
$schema_insert .= "/t";
print(trim($schema_insert));
print "/n";
}
exit;
?>
- php导出excel
- PHP 导出EXCEL报表
- php导出Excel方法
- PHP导出Excel文件
- php导出Excel
- PHP导出Excel
- php导出excel
- PHP导出excel乱码
- PHP导出导入Excel
- php导出excel
- PHP导出EXCEL
- php导出excel乱码
- php导出excel
- php导出excel
- php导出Excel
- php简单导出excel
- PHP导出Excel文件
- PHP导出excel
- 2950 SSH、AutoQos、802.1x with VLAN等配置实例
- DataGrid突出现实当前页码
- 生成xml文档
- C#代码规范(范例)
- cisco Auto Secure configure
- php导出excel
- 远程TELNET的路由器启用NAGLE
- 服务质量Qos-Quality of service
- ipv6 6to4 tunnel config
- 如何使用# ## ... _ _VA_ARGS_ _
- AS5300语音网关配置
- FTTB+NAT+DHCP+pppoe+CBAC+vpn client+AAA
- Windows操作系统下面利用C++语言进行内存共享程序的编写
- Use a Static Route to the Null0 Interface for routing Loop