);
fputcsv($output, $arrkeys);
}
fclose($output) or die("can't close ");
exit();
?>
2、导入xls文件
查看源码
打印代码帮助
<?php
require_once (dirname(__FILE__) . "/../include/common.inc.php");
include_once("excel/reader.php");
$tmp = $_FILES['file']['tmp_name'];
if (empty ($tmp)) {
ShowMsg("请选择要导入的Excel文件!","test.php");
exit;
}
$save_path = "xls/";
$file_name = $save_path.date('Ymdhis') . ".xls";
if (copy($tmp, $file_name)) {
$xls = new Spreadsheet_Excel_Reader();
$xls->setOutputEncoding('utf-8');
$xls->read($file_name);
for ($i=2; $i<=$xls->sheets[0]['numRows']; $i++) {