Home > Backend Development > PHP Tutorial > PHP处理excel cvs表格的方法实例介绍_PHP

PHP处理excel cvs表格的方法实例介绍_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 12:07:03
Original
1131 people have browsed it
复制代码 代码如下:
<?php <BR>$data = array(); <BR>//convert a cvs file to an array $data <BR>$handle = fopen("data.csv","r"); <BR>while ($curline = fgetcsv($handle, 1000, ",")){ <BR>$tmp = array(); <BR>$num = count($curline); <BR>for($c=0; $c < $num; $c++){ <BR>array_push($tmp, $curline[c]); <BR>} <BR>array_push($data, $tmp); <BR>} <BR>print_r($data); <BR>fclose($handle); <BR>//convert array $data back to a cvs file <BR>$handle = fopen("result.csv","w"); <BR>foreach($data as $curline){ <BR>if(fputcsv($handle, $curline)==false){ <BR>die("cannot write CSV line"); <BR>} <BR>} <BR>fclose($handle); <BR>?> <BR>
Copy after login




Copy after login

Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template