Home > php教程 > php手册 > PHP 简易输出CSV表格文件的方法详解

PHP 简易输出CSV表格文件的方法详解

WBOY
Release: 2016-06-06 20:30:08
Original
1030 people have browsed it

本篇文章是对PHP 简易输出CSV表格文件的方法进行了详细的分析介绍,需要的朋友参考下

复制代码 代码如下:


$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;

,香港虚拟主机,香港服务器,香港服务器租用
Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template