当前位置:  首页  >  PHP教程  >  PHP 应用  >  代码收藏

PHP导出Excel案列_PHP教程

PHP导出Excel案列。PHP导出Excel案列$dataarray();$data$app-getStatisApp(2,$username,$whereDepartment,$status,$level,$time);$strmb_convert_encoding(姓名,一级部门,所在部门,直属

PHP导出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;

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1060985.htmlTechArticlePHP导出Excel案列 $data = array(); $data = $app-getStatisApp(2,$username,$whereDepartment,$status,$level,$time); $str = mb_convert_encoding (姓名,一级部门,所在部门,直属...

吐了个 "CAO" !
扫码关注 PHP1 官方微信号
PHP1.CN | 中国最专业的PHP中文社区 | PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | PHP问答
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved PHP1.CN 第一PHP社区 版权所有