Home >Backend Development >PHP Tutorial >PHP export Excel case_PHP tutorial

PHP export Excel case_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:07:23958browse

PHP export Excel case

$data = array();
$data = $app->getStatisApp(2,$username,$whereDepartment,$status,$level,$time);
$str = mb_convert_encoding ("Name, first-level department, department, immediate superior, entry time n", 'GBK', 'UTF8' );
$filename = "Review Progress Statistics of Regularization Application Form";
$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 export Excel case list $data = array(); $data = $app-getStatisApp(2,$username ,$whereDepartment,$status,$level,$time); $str = mb_convert_encoding (name, first-level department, department, direct subordinate...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn