Home > Backend Development > PHP Tutorial > Detailed explanation of how to easily output CSV table files in PHP_PHP Tutorial

Detailed explanation of how to easily output CSV table files in PHP_PHP Tutorial

WBOY
Release: 2016-07-21 15:05:06
Original
875 people have browsed it

Copy code The code is as follows:

$ret = '';
$arrs = array(array(1,'test1' ),
array(2,'test2'),
array(3,'test3'),
array(4,'test4'),
array(5,'test5'),
array(6,'test6'),
array(7,'test7')
);
foreach($arrs as $k=>$arr){
$ret .= $arr[0].",".$arr[1]." n";
}
//$ret = @mb_convert_encoding ($ret, 'GBK','UTF-8') ;
header("Content-Disposition: attachment; filename=xxxx.csv");
header("Content-Type:APPLICATION/OCTET-STREAM");
echo $ret;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327729.htmlTechArticleCopy the code as follows: $ret = ''; $arrs = array(array(1,'test1') , array(2,'test2'), array(3,'test3'), array(4,'test4'), array(5,'test5'), array(6,'test6'), array(7, 'test7') );...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template