發(fā)表日期:2018-05 文章編輯:小燈 瀏覽次數(shù):3254
<?php require_once (dirname(__FILE__) . "/../include/common.inc.php");$output = fopen('','w') or die("can't open ");header('Content-Type: application/csv');header('Content-Disposition: attachment; filename="認(rèn)證列表.csv"');$arrkeys = array(iconv('utf-8','gb2312','姓名'),iconv('utf-8','gb2312','電話(huà)')//文件表頭);fputcsv($output, $arrkeys);//取得符合條件的數(shù)組 $sql = "SELECT * FROM dede_test"; $dsql->Execute('me',$sql); while($row = $dsql->GetArray('me')){$name =$row['name'];$mobile= $row['mobile']; //循環(huán) $arrkeys = array(iconv('utf-8','gb2312',$name),iconv('utf-8','gb2312',$mobile));fputcsv($output, $arrkeys);} fclose($output) or die("can't close ");exit();?> |
<?php require_once (dirname(__FILE__) . "/../include/common.inc.php"); include_once("excel/reader.php"); $tmp = $_FILES['file']['tmp_name']; if (empty ($tmp)) { ShowMsg("請(qǐng)選擇要導(dǎo)入的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++) { $name = $xls->sheets[0]['cells'][$i][1]; $mobile = $xls->sheets[0]['cells'][$i][2] $data_values .= "('$name','$mobile'),"; } $data_values = substr($data_values,0,-1); $sql= "INSERT INTO dede_test (name,mobile) VALUES $data_values";$dsql->ExecuteNoneQuery($sql); $lastInsertID = $dsql->GetLastID(); if($dsql){ShowMsg("成功導(dǎo)入!","test.php"); }else{ShowMsg("導(dǎo)入失??!","test.php"); } } exit();?> |
日期:2018-10 瀏覽次數(shù):3750
日期:2018-10 瀏覽次數(shù):3498
日期:2018-08 瀏覽次數(shù):3582
日期:2018-06 瀏覽次數(shù):3334
日期:2018-06 瀏覽次數(shù):3182
日期:2018-06 瀏覽次數(shù):3234
日期:2018-06 瀏覽次數(shù):3495
日期:2018-06 瀏覽次數(shù):3337
日期:2018-06 瀏覽次數(shù):3257
日期:2018-06 瀏覽次數(shù):3432
日期:2018-05 瀏覽次數(shù):3340
日期:2018-05 瀏覽次數(shù):4149
日期:2018-05 瀏覽次數(shù):3253
日期:2018-05 瀏覽次數(shù):3666
日期:2018-04 瀏覽次數(shù):4118
日期:2018-03 瀏覽次數(shù):3258
日期:2018-03 瀏覽次數(shù):3134
日期:2018-03 瀏覽次數(shù):3321
日期:2018-02 瀏覽次數(shù):3314
日期:2018-02 瀏覽次數(shù):3282
日期:2017-12 瀏覽次數(shù):3424
日期:2017-12 瀏覽次數(shù):3656
日期:2017-12 瀏覽次數(shù):3842
日期:2017-12 瀏覽次數(shù):3216
日期:2017-12 瀏覽次數(shù):3202
日期:2017-11 瀏覽次數(shù):3240
日期:2017-11 瀏覽次數(shù):3312
日期:2017-11 瀏覽次數(shù):3210
日期:2017-11 瀏覽次數(shù):3338
日期:2017-11 瀏覽次數(shù):3906
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.