栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

php导出excel

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

php导出excel

php导出excel(转)

在index.php文件中,添加一个连接,导出excel。
test1.php文件如下:
 Header("Content-type:    application/octet-stream");  
 Header("Accept-Ranges:    bytes");  
 Header("Content-type:application/vnd.ms-excel");    
 Header("Content-Disposition:attachment;filename=export_excel_gshjsl.xls");    

 $tx='表头';  
 echo    $tx."nn";
 echo    "编号"."t";  
 echo    "姓名"."t";  
 echo    "n";

echo "="411481198507150666""."t";
echo "="0123456""."t";            //带上引号方便字符串输出。相当如设置单元格格式为文本。
echo "n";
?>



顺便把简单导出word文档的代码贴到这里:

 header("Content-Type:    application/msword");        
 header("Content-Disposition:    attachment;    filename=doc.doc");        
 header("Pragma:    no-cache");        
 header("Expires:    0");        

 $output     =    '

';        
 $output    .=    '';        
 $output    .=    '';        
 $output    .=    '
图片
下面是一张图片
 $output    .=    '
';  


 echo    $output;        
 ?>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/229006.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号