码迷,mamicode.com
首页 > Web开发 > 详细

PHP导出Excel案列

时间:2015-10-14 21:55:18      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:status   excel   申请表   统计   姓名   

$data = array();
$data = $app->getStatisApp(2,$username,$whereDepartment,$status,$level,$time);
$str = mb_convert_encoding ("姓名,一级部门,所在部门,直属上级,入职时间\n", ‘GBK‘, ‘UTF8‘ );
$filename = "转正申请表审核进度统计";
$filename = mb_convert_encoding ( $filename, ‘GBK‘, ‘UTF8‘ );
ob_end_clean ();
header ( "HTTP/1.1 200 OK" );
header ( ‘Content-Encoding: none‘ );
header ( ‘Content-type:text/csv‘ );
header ( "Content-Disposition:attachment;filename={$filename}.csv" );
header ( ‘Cache-Control:must-revalidate,post-check=0,pre-check=0,max-age=31536000‘ );
header ( ‘Expires:0‘ );
header ( ‘Pragma:public‘ );
foreach ( $data as $value ) {
    $str .= mb_convert_encoding ( "{$value[‘truename‘]},{$value[‘oneDepartment‘]},{$value[‘twoDepartment‘]},{$value[‘leaderTruename‘]},{$value[‘entry_time‘]},{$value[‘formal_time‘]}\n", ‘GBK‘, ‘UTF8‘);
}
echo $str;

本文出自 “欧阳俊” 博客,请务必保留此出处http://ouyangjun.blog.51cto.com/10284323/1702903

PHP导出Excel案列

标签:status   excel   申请表   统计   姓名   

原文地址:http://ouyangjun.blog.51cto.com/10284323/1702903

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!