• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Spreadsheet_Excel_Reader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Spreadsheet_Excel_Reader的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader类的具体用法?PHP Spreadsheet_Excel_Reader怎么用?PHP Spreadsheet_Excel_Reader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Spreadsheet_Excel_Reader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: main

 public function main($UrlAppend = NULL, $get = NULL, $post = NULL)
 {
     if ($this->_isPost()) {
         $data = new Spreadsheet_Excel_Reader();
         $data->setOutputEncoding('utf-8');
         $file = $this->_upload();
         $data->read($file["path"]);
         $keyArr = array();
         for ($a = 1; $a < 1000; $a++) {
             if ($data->sheets[0]['cells'][1][$a] != "") {
                 array_push($keyArr, $data->sheets[0]['cells'][1][$a]);
             }
         }
         $dataList = array();
         for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
             $valueArr = array();
             for ($b = 0; $b < count($keyArr); $b++) {
                 if ($keyArr[$b] == "key") {
                     $key = $data->sheets[0]['cells'][$i][$b + 1];
                 } else {
                     $valueArr[$keyArr[$b]] = $data->sheets[0]['cells'][$i][$b + 1];
                 }
             }
             $dataList[$key] = $valueArr;
         }
         $this->_f($_POST["FileName"], $dataList);
     }
     return $this->_assign;
 }
开发者ID:huangwei2wei,项目名称:kfxt,代码行数:29,代码来源:Default.class.php


示例2: excelreader

 public function excelreader()
 {
     $this->load->library('Spreadsheet_Excel_Reader.php');
     $data = new Spreadsheet_Excel_Reader("./data/example01.xls");
     //	$data = json_decode('{$data}',true);
     echo $data->dump(true, true);
 }
开发者ID:biao0102,项目名称:local_gwadmin,代码行数:7,代码来源:mylib.php


示例3: getAll

 function getAll()
 {
     $reader = new Spreadsheet_Excel_Reader();
     $reader->setUTFEncoder('iconv');
     $reader->setOutputEncoding('UTF-8');
     $reader->read($this->filename);
     $data = array();
     $index_row = 1;
     if ($this->have_header) {
         $index_row = 2;
     }
     $iterator = -1;
     for ($i = $index_row; $i <= $reader->sheets[$this->sheet_index]['numRows']; $i++) {
         $iterator++;
         $data[$iterator] = array();
         for ($j = 1; $j <= $reader->sheets[$this->sheet_index]['numCols']; $j++) {
             if ($this->have_header) {
                 $data[$iterator][$this->headers[$j - 1]] = $reader->sheets[0]['cells'][$i][$j];
             } else {
                 $data[$iterator][$j - 1] = $reader->sheets[0]['cells'][$i][$j];
             }
         }
     }
     return $data;
 }
开发者ID:radityopw,项目名称:zazzle-php,代码行数:25,代码来源:excel_reader.class.php


示例4: fileToArray

 /**
   Helper for xls files. See fileToArray()
 */
 public static function xlsToArray($filename, $limit)
 {
     if (!class_exists('Spreadsheet_Excel_Reader')) {
         include_once dirname(__FILE__) . '/../../src/Excel/xls_read/reader.php';
     }
     $data = new \Spreadsheet_Excel_Reader();
     $data->setOutputEncoding('ISO-8859-1');
     $data->read($filename);
     $sheet = $data->sheets[0];
     $rows = $sheet['numRows'];
     $cols = $sheet['numCols'];
     $ret = array();
     for ($i = 1; $i <= $rows; $i++) {
         $line = array();
         for ($j = 1; $j <= $cols; $j++) {
             if (isset($sheet['cells'][$i]) && isset($sheet['cells'][$i][$j])) {
                 $line[] = $sheet['cells'][$i][$j];
             } else {
                 $line[] = '';
             }
         }
         $ret[] = $line;
         if ($limit != 0 && count($ret) >= $limit) {
             break;
         }
     }
     return $ret;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:31,代码来源:FileData.php


示例5: import

 public function import($file)
 {
     try {
         $users = array();
         $params = array(1 => 'user_name', 'user_password', 'user_first_name', 'user_last_name', 'user_email', 'user_group', 'user_vhost');
         $excel = new Spreadsheet_Excel_Reader($file);
         $rows = $excel->rowcount($sheet_index = 0);
         $cols = $excel->colcount($sheet_index = 0);
         for ($row = 2; $row <= $rows; $row++) {
             if ($cols == 7) {
                 for ($col = 1; $col <= $cols; $col++) {
                     $users[$row][$params[$col]] = $excel->val($row, $col);
                     $users[$row]['user_vhost'] = explode(',', $excel->val($row, 7));
                     $users[$row]['user_group'] = '';
                 }
             }
         }
         $this->userimport = new userimport();
         $users = $this->userimport->import($users);
         $_SESSION['message'] = $this->userimport->get_message();
         return $users;
     } catch (Exception $e) {
         display_page_error();
     }
 }
开发者ID:jabouzi,项目名称:projet,代码行数:25,代码来源:xlsimportadapter.php


示例6: import

 /**
  * Importa la nomina de estudiantes desde una hoja excel
  */
 public function import($archivo)
 {
     include_once 'system/application/libraries/excel_reader2.php';
     $excel = new Spreadsheet_Excel_Reader("system/excel/alumnos/{$archivo}");
     $i = 2;
     $this->db->trans_start();
     while (intval($excel->val($i, 1))) {
         $codigo = intval($excel->val($i, 1));
         $arr = array();
         foreach ($this->columnas as $col => $pos) {
             $arr[$col] = $excel->val($i, $pos);
         }
         $arr['sexo'] = intval($arr['sexo']) == 1 ? 'M' : 'F';
         if ($alumno = $this->alumnoExiste($codigo)) {
             // Actualizar
             $arr['id'] = $alumno['id'];
             $this->update($arr);
         } else {
             // Crear
             $this->create($arr);
         }
         $i++;
     }
     $this->db->trans_complete();
 }
开发者ID:boriscy,项目名称:san_lorenzo,代码行数:28,代码来源:alumno_model.php


示例7: do_upload

 function do_upload()
 {
     $config['upload_path'] = './upload/';
     $config['allowed_types'] = 'php|txt|xls|xml';
     $config['max_size'] = '1000000';
     //$config['max_width']  = '1024';
     //$config['max_height']  = '768';
     $this->load->library('upload', $config);
     if (!$this->upload->do_upload()) {
         $error = array('error' => $this->upload->display_errors());
         //$this->load->view('header');
         $this->load->view('upload_view', $error);
         //$this->load->view('footer');
     } else {
         $data = array('upload_data' => $this->upload->data());
         $this->load->library('Excel/spreadsheet_Excel_Reader');
         //require_once 'Excel/reader.php';
         // ExcelFile($filename, $encoding);
         $excel = new Spreadsheet_Excel_Reader();
         // Set output Encoding.
         $excel->setOutputEncoding('CP1251');
         //lecture du fichier excel
         //chmod('./upload/' . $data['upload_data']['file_name'], 0777);
         $excel->read('./upload/' . $data['upload_data']['file_name']);
         //$liste = array($excel->sheets[0]['numRows'],2);
         $array = $excel->sheets[0]['cells'];
         $temp = array_shift($array);
         var_dump($array);
         //$this->data_model->insert_entry($array);
         $this->load->view('upload_success', $data);
     }
 }
开发者ID:jabouzi,项目名称:3b,代码行数:32,代码来源:upload.php


示例8: ABSSAV

function ABSSAV()
{
    $inFile = $_REQUEST['inFile'];
    echo "Filename is: {$inFile}<br>";
    require_once 'Excel/reader.php';
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('CP1251');
    $data->read($inFile);
    error_reporting(E_ALL ^ E_NOTICE);
    $Target_Database = 'binawan';
    $Target_Table = $Target_Database . '.ruang';
    $Target_KodeID = "BINAWAN";
    $s = "TRUNCATE TABLE {$Target_Table}";
    $r = _query($s);
    for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
        $w = array();
        $w['RuangID'] = trim($data->sheets[0]['cells'][$i][2]);
        $w['Nama'] = trim($data->sheets[0]['cells'][$i][3]);
        $w['Kapasitas'] = trim($data->sheets[0]['cells'][$i][4]);
        $w['KapasitasUjian'] = trim($data->sheets[0]['cells'][$i][4]);
        $w['KolomUjian'] = trim($data->sheets[0]['cells'][$i][5]);
        $w['KampusID'] = trim($data->sheets[0]['cells'][$i][6]);
        $w['Lantai'] = trim($data->sheets[0]['cells'][$i][7]);
        $w['RuangKuliah'] = trim($data->sheets[0]['cells'][$i][8]);
        $s = "insert into {$Target_Table}\r\n          (RuangID, Nama, Kapasitas, KapasitasUjian, KolomUjian, KampusID, Lantai, KodeID, RuangKuliah, UntukUSM\r\n\t      )\r\n          values\r\n          ('{$w['RuangID']}', '{$w['Nama']}', '{$w['Kapasitas']}', '{$w['KapasitasUjian']}', '{$w['KolomUjian']}', '{$w['KampusID']}', '{$w['Lantai']}', 'BINAWAN', '{$w['RuangKuliah']}', '{$w['RuangKuliah']}'\r\n\t      )";
        $r = _query($s);
    }
    echo "<script>window.location = '?{$mnux}={$_SESSION['mnux']}'</script>";
}
开发者ID:anggadjava,项目名称:mitra_siakad,代码行数:29,代码来源:_exceltosql.php


示例9: doimport

 function doimport()
 {
     $file_name = $_GET['province_id'] . ".xls";
     if ($file_name != '') {
         //$ext = pathinfo($_FILES['filename']['name'], PATHINFO_EXTENSION);
         //echo $file_name = 'nursery.'.$ext;
         $uploaddir = 'import/tmp/';
         $fpicname = $uploaddir . $file_name;
         ///move_uploaded_file($_FILES['filename']['tmp_name'], $fpicname);
         require_once 'include/Excel/reader.php';
         $data = new Spreadsheet_Excel_Reader();
         $data->setOutputEncoding('UTF-8');
         $data->read($fpicname);
         error_reporting(E_ALL ^ E_NOTICE);
         $index = 0;
         for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
             $amphur = new Amphur();
             $amphur = $amphur->where(" amphur_name ='" . trim($data->sheets[0]['cells'][$i][1]) . "'")->get();
             $import[$index]['province_id'] = $_POST['province_id'];
             $import[$index]['amphur_id'] = $amphur->id;
             $import[$index]['name'] = trim($data->sheets[0]['cells'][$i][2]);
             $index++;
             if ($amphur->id > 0) {
                 $_POST['province_id'] = $_GET['province_id'];
                 $_POST['amphur_id'] = $amphur->id;
                 $_POST['name'] = trim($data->sheets[0]['cells'][$i][2]);
                 $nursery = new Nursery_Tmp();
                 $nursery->from_array($_POST);
                 $nursery->save();
             }
         }
     }
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:33,代码来源:nurseries.php


示例10: insertUpdateNotas

 /**
  * Realiza la inserción o actualización de notas de un estudiante
  * @param string
  * @param integer
  */
 function insertUpdateNotas($archivo, $anio)
 {
     include_once 'system/application/libraries/excel_reader2.php';
     $excel = new Spreadsheet_Excel_Reader("system/excel/notas/{$archivo}");
     $alumnos = $this->loadModel('Alumno_model')->getList(array('labelField' => 'id', 'valueField' => 'codigo'));
     $materias = $this->loadModel('Materia_model')->getList(array('labelField' => 'id', 'valueField' => 'nombre'));
     $i = 2;
     $this->errors = array();
     $this->db->trans_start();
     while (trim($excel->val($i, 1)) != '') {
         $codigo = trim($excel->val($i, 1));
         if (!isset($alumnos[$codigo])) {
             array_push($this->errors, "No existe un alumno con código \"{$codigo}\" fila {$i} del archivo excel");
             $i++;
             continue;
         }
         $alumno_id = $alumnos[$codigo];
         $materia_nombre = trim($excel->val($i, 2));
         if (!isset($materias[$materia_nombre])) {
             array_push($this->errors, "No existe la materia \"{$materia_nombre}\" en la fila {$i} del archivo excel");
             $i++;
             continue;
         }
         $materia_id = $materias[$materia_nombre];
         $this->setNota($alumno_id, $materia_id, $excel, $anio, $i);
         $i++;
     }
     $this->db->trans_complete();
     return $this->errors;
 }
开发者ID:boriscy,项目名称:san_lorenzo,代码行数:35,代码来源:nota_model.php


示例11: add_in_mysql

 public function add_in_mysql()
 {
     if (!empty($_FILES['efile']['name'])) {
         $exname = strtolower(substr($_FILES['efile']['name'], strrpos($_FILES['efile']['name'], '.') + 1));
         $uploadfile = $this->getnames($exname);
         //上传后文件所在的路径
         @move_uploaded_file($_FILES['efile']['tmp_name'], $uploadfile);
     }
     $data = new Spreadsheet_Excel_Reader();
     $data->setOutputEncoding('utf-8');
     $data->read($uploadfile);
     //读取要导入数据库的文件
     error_reporting(E_ALL ^ E_NOTICE);
     $Stu = D("Stu");
     //$User->startTrans();//启动事务;
     $filed = C("excle");
     //获取字段对应的列
     for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
         $col = $data->sheets[0]['cells'][$i];
         $arr = array("stuno" => $col[$filed["stuno"]], "stuname" => $col[$filed["stuname"]], "password" => $col[$filed["password"]], "sex" => $col[$filed["sex"]], "idcard" => $col[$filed["idcard"]], "classno" => $col[$filed["classno"]], "college" => "1");
         $Stu->create($arr);
         echo $Stu->getError() . "<br/>";
         if (!$Stu->add()) {
             $Stu->rollback();
             //不成功,回滚
             echo "导入失败回滚";
             return;
         }
         echo $arr["stuno"] . "导入成功<br/>";
     }
     $Stu->commit();
     //成功提交
 }
开发者ID:zhujunxxxxx,项目名称:zzadmin,代码行数:33,代码来源:ImportAction.class.php


示例12: readRoom

function readRoom($file, $table, $pos)
{
    require_once "conn.php";
    $sql = "TRUNCATE TABLE {$table}";
    if ($mysqliObj->query($sql)) {
        echo "truncate success" . "</br>";
    }
    require_once 'Excel/reader.php';
    // ExcelFile($filename, $encoding);
    $data = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    // $data->setOutputEncoding('CP936');
    $data->setOutputEncoding('gbk');
    $data->read($file);
    error_reporting(E_ALL ^ E_NOTICE);
    //$data->sheets[0]['numRows']
    for ($i = $pos; $i <= $data->sheets[0]['numRows']; $i++) {
        $msg1 = $data->sheets[0]['cells'][$i][1];
        $msg2 = $data->sheets[0]['cells'][$i][2];
        $msg3 = $data->sheets[0]['cells'][$i][3];
        $sql = "INSERT INTO  {$table} (`roomId` ,`type` ,`price` )\n\t\t\t\tVALUES ('{$msg1}',  '{$msg2}',  '{$msg3}')";
        if (!is_null($data->sheets[0]['cells'][$i][1])) {
            $mysqliObj->query($sql);
        }
    }
    $mysqliObj->close();
}
开发者ID:kongsicong,项目名称:HotelManageSystem,代码行数:27,代码来源:RoomInfo.php


示例13: ABSSAV

function ABSSAV()
{
    $inFile = $_REQUEST['inFile'];
    require_once 'Excel/reader.php';
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('CP1251');
    $data->read($inFile);
    error_reporting(E_ALL ^ E_NOTICE);
    $Target_Database = 'binawan';
    $Target_Table = $Target_Database . 'mhsw';
    $Target_KodeID = "BINAWAN";
    $s = "TRUNCATE TABLE ";
    $r = _query($s);
    for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
        $w = array();
        $w['MhswID'] = trim($data->sheets[0]['cells'][$i][1]);
        $w['TahunID'] = trim($data->sheets[0]['cells'][$i][2]);
        $w['Nama'] = trim($data->sheets[0]['cells'][$i][3]);
        $w['Kelamin'] = trim($data->sheets[0]['cells'][$i][4]);
        $w['TempatLahir'] = trim($data->sheets[0]['cells'][$i][5]);
        $w['TanggalLahir'] = trim($data->sheets[0]['cells'][$i][6]);
        $w['Agama'] = trim($data->sheets[0]['cells'][$i][7]);
        $w['Alamat'] = trim($data->sheets[0]['cells'][$i][8]);
        $s = "insert into {$Target_Database}\r\n          (MhswID, Login, LevelID, Password, PMBID, \r\n\t\t   TahunID, KodeID, Nama, \r\n\t\t   Foto, StatusMhswID, ProgramID, ProdiID, KelasID,\r\n\t\t   Kelamin, TempatLahir, TanggalLahir, Agama, Alamat, \r\n\t\t   Kota, RT, RW, KodePos, Propinsi, Negara, \r\n\t\t   Telepon, Handphone \r\n\t      )\r\n          values\r\n          ('{$w['MhswID']}', '{$w['Login']}', '120', '{$w['Password']}', '{$w['PMBID']}', \r\n\t\t   '{$w['TahunID']}', '{$Target_KodeID}', '{$w['Nama']}', \r\n\t\t   '{$w['Foto']}', '{$w['StatusMhswID']}', '{$w['ProgramID']}', '{$w['ProdiID']}', '{$w['KelasID']}',\r\n\t\t   '{$w['Kelamin']}', '{$w['TempatLahir']}', '{$w['TanggalLahir']}', '{$w['Agama']}', '{$w['Alamat']}', \r\n\t\t   '{$w['Kota']}', '{$w['RT']}', '{$w['RW']}', '{$w['KodePos']}', '{$w['Propinsi']}', '{$w['Negara']}', \r\n\t\t   '{$w['Telepon']}', '{$w['Handphone']}' \r\n\t      )";
        $r = _query($s);
    }
    echo "<script>window.location = '?{$mnux}={$_SESSION['mnux']}'</script>";
}
开发者ID:anggadjava,项目名称:mitra_siakad,代码行数:28,代码来源:_exceltosql-ori.php


示例14: updateDB

function updateDB($startIndex, $endIndex)
{
    //need to copy the code that does the excel reading
    $analysisData = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    $analysisData->setOutputEncoding('CP1251');
    $inputFileName = 'ReverseGeoCodingForStopsVerification.xls';
    $analysisData->read($inputFileName);
    error_reporting(E_ALL ^ E_NOTICE);
    $numRows = $analysisData->sheets[0]['numRows'];
    $numCols = $analysisData->sheets[0]['numCols'];
    //echo $numRows.",".$numCols;
    $strRoute = '<Routes>';
    for ($i = $startIndex; $i <= $endIndex; $i++) {
        $stopId = $analysisData->sheets[0]['cells'][$i][1];
        $StopName = $analysisData->sheets[0]['cells'][$i][2];
        $Buses = $analysisData->sheets[0]['cells'][$i][3];
        $latitude = $analysisData->sheets[0]['cells'][$i][4];
        $longitude = $analysisData->sheets[0]['cells'][$i][5];
        $strRoute = $strRoute . '<Route>';
        $routeDetails = htmlentities(trim($StopName)) . ":" . $latitude . ":" . $longitude;
        //echo $routeDetails."<br/>";
        $strRoute = $strRoute . '<RouteDetails>' . $routeDetails . '</RouteDetails>';
        $strRoute = $strRoute . '</Route>';
    }
    $strRoute = $strRoute . '</Routes>';
    echo $strRoute;
}
开发者ID:rohdimp24,项目名称:test,代码行数:28,代码来源:ReverseGeoCodingForStopsVerification.php


示例15: getDataFromExcel

 function getDataFromExcel($filename)
 {
     $uimap = new Spreadsheet_Excel_Reader();
     $uimap->read($this->path . "\\data\\uimap\\" . $filename . ".xls");
     $s = 0;
     foreach ($uimap->boundsheets as $ar) {
         $i = 2;
         while ($i <= $uimap->sheets[$s]['numRows']) {
             if (!empty($uimap->sheets[$s]['cells'][$i][2]) && !empty($uimap->sheets[$s]['cells'][$i][3]) && strtolower($ar['name']) != 'datamap') {
                 $this->sheets[strtolower($ar['name'])][strtolower($uimap->sheets[$s]['cells'][$i][2])] = $uimap->sheets[$s]['cells'][$i][3];
             } elseif (!empty($uimap->sheets[$s]['cells'][$i][2]) && strtolower($ar['name']) == 'datamap') {
                 $datafile = new Spreadsheet_Excel_Reader();
                 $datafile->read($this->path . "\\" . $uimap->sheets[$s]['cells'][$i][3]);
                 $j = 2;
                 while ($j <= $datafile->sheets[0]['numRows']) {
                     if (!empty($datafile->sheets[0]['cells'][$j][2])) {
                         if (empty($datafile->sheets[0]['cells'][$j][4])) {
                             $this->datamap[strtolower($datafile->sheets[0]['cells'][$j][2])] = $datafile->sheets[0]['cells'][$j][3];
                         } else {
                             $y = 3;
                             while (!empty($datafile->sheets[0]['cells'][$j][$y])) {
                                 $this->datamap[strtolower($datafile->sheets[0]['cells'][$j][2])][] = $datafile->sheets[0]['cells'][$j][$y];
                                 $y++;
                             }
                         }
                     }
                     $j++;
                 }
             }
             $i++;
         }
         $s++;
     }
     $this->uimap = $this->sheets;
 }
开发者ID:erlendfh,项目名称:Bromine,代码行数:35,代码来源:Dataparser.php


示例16: localUploadSNExcel

 public function localUploadSNExcel()
 {
     $return = $this->localUpload(array('xls'));
     if ($return['error']) {
         $this->error($return['msg']);
     } else {
         $data = new Spreadsheet_Excel_Reader();
         // 设置输入编码 UTF-8/GB2312/CP936等等
         $data->setOutputEncoding('UTF-8');
         $data->read(str_replace('http://' . $_SERVER['HTTP_HOST'], $_SERVER['DOCUMENT_ROOT'], $return['msg']));
         chmod(str_replace('http://' . $_SERVER['HTTP_HOST'], $_SERVER['DOCUMENT_ROOT'], $return['msg']), 0777);
         //
         $sheet = $data->sheets[0];
         $rows = $sheet['cells'];
         if ($rows) {
             $i = 0;
             foreach ($rows as $r) {
                 if ($i != 0) {
                     $db = M('Lottery_record');
                     $where = array('token' => $this->token, 'lid' => intval($_POST['lid']), 'sn' => trim($r[1]));
                     $check = $db->where($where)->find();
                     if (!$check) {
                         $where['prize'] = intval($r['2']);
                         $db->add($where);
                     }
                 }
                 $i++;
             }
         }
         $this->success('操作完成');
     }
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:32,代码来源:UpyunAction.class.php


示例17: popola

function popola($file, $id_associazione)
{
    $data = new Spreadsheet_Excel_Reader();
    //$data->setOutputEncoding('CP1251'); //UTF-8
    $data->setOutputEncoding('UTF-8');
    $data->read($file);
    error_reporting(E_ALL ^ E_NOTICE);
    $counter = 0;
    $counterP = 0;
    $log_error = new log();
    for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
        $counterP++;
        echo $counterP . " ";
        if ($counterP % 100 == 0) {
            echo "\n  Processati: " . $counterP . "\n";
        }
        ob_flush();
        flush();
        $query = "INSERT into soci (nome,mail) values ";
        $query .= "(";
        echo $data->sheets[0]['cells'][$i][1] . "   ... \n";
        $actual_element = trim($data->sheets[0]['cells'][$i][1], " \t\n\r\v,;");
        echo $actual_element;
        $actual_element = mysql_real_escape_string($actual_element);
        $actual_element2 = trim($data->sheets[0]['cells'][$i][2], " \t\n\r\v,;");
        $mail = mysql_real_escape_string($actual_element2);
        $query .= "'" . $actual_element . "','" . $mail . "'";
        // Aggiungi user e password
        //$query.="'".(($email=="") ? getUniqueCode(10) : $email)."','".getUniqueCode(10)."',$id_associazione";
        $query .= ")";
        //validate email
        if (!Swift_Validate::email($actual_element2)) {
            //validate email, log error
            $log_error->scrivi_popola($actual_element . "\t" . $mail);
        } else {
            //insert into DB
            $result = mysql_query("SELECT id FROM soci WHERE mail='" . $mail . "'");
            if ($riga = mysql_fetch_assoc($result)) {
                //if the mail is  already in the database
                $int_id = $riga['id'];
            } else {
                if (!mysql_query($query)) {
                    //insert new record
                    echo "ti è andata male   ";
                    echo $query;
                    return false;
                }
                $int_id = mysql_insert_id();
                $counter++;
            }
            if ($id_associazione > 0) {
                mysql_query("INSERT into interessi_soci (id_socio,id_interesse) values ('{$int_id}','{$id_associazione}')");
            }
        }
    }
    $log_error->close_popola();
    //return $data->sheets[0]['numRows']-1;
    return "<BR>Letti " . $counterP . " e inseriti (non duplicati) " . $counter;
}
开发者ID:bobbylinux,项目名称:CasaRabatti,代码行数:59,代码来源:funzioni.php


示例18: integrationExcel

 public function integrationExcel()
 {
     $controller = $this->config();
     echo "<br />Excel Spreadsheet<br/>";
     echo $spreadsheet = $controller->buildExcelTable(1, 1, 1, 1, 1, 1, array(1989, 1992));
     $data = new Spreadsheet_Excel_Reader($spreadsheet);
     echo $data->dump(true, true);
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:8,代码来源:ReportIntegrationTest.php


示例19: get_student_schedule

function get_student_schedule($filename, $teacherSchedule)
{
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('UTF8');
    $data->setUTFEncoder('mb');
    $data->read($filename);
    return get_result_student($data, $teacherSchedule);
}
开发者ID:CocDamCode,项目名称:fu-where-are-you,代码行数:8,代码来源:parserStudent.php


示例20: importsiswa

 public function importsiswa()
 {
     require_once 'application/controllers/base/excel_reader2.php';
     echo '<html><head><title>Loading...</title></head><body></body></html>';
     $xls = $_FILES['data-import'];
     if (!empty($_FILES['data-import']['name'])) {
         $this->load->library('upload');
         //load upload lobrary
         $xls_name = str_replace(' ', '_', $xls['name']);
         $config['upload_path'] = './assets/xls/';
         $config['allowed_types'] = '*';
         $config['max_size'] = '2000000';
         //2MB
         $config['overwrite'] = true;
         $this->upload->initialize($config);
         if (!$this->upload->do_upload('data-import')) {
             //Upload Failed
             echo $this->upload->display_errors();
         } else {
             //Upload Complete
             $siswa = new Spreadsheet_Excel_Reader('./assets/xls/' . $xls_name);
             $rows = $siswa->rowcount(0);
             // echo $rows;
             //looping to insert database
             for ($i = 2; $i < $rows; $i++) {
                 $nis = $siswa->val($i, 1, 0);
                 //baris ke $i, kolom 1, sheet 1
                 $angkatan = $siswa->val($i, 2, 0);
                 $nama = $siswa->val($i, 3, 0);
                 $subkelas1 = $siswa->val($i, 4, 0);
                 $subkelas2 = $siswa->val($i, 5, 0);
                 $subkelas3 = $siswa->val($i, 6, 0);
                 if (empty($subkelas1)) {
                     $subkelas1 = null;
                 }
                 if (empty($subkelas2)) {
                     $subkelas2 = null;
                 }
                 if (empty($subkelas3)) {
                     $subkelas3 = null;
                 }
                 $status = $siswa->val($i, 7, 0);
                 $kelamin = $siswa->val($i, 8, 0);
                 $password = md5($nis);
                 $data = array('nis' => $nis, 'angkatan' => $angkatan, 'nama_lengkap' => $nama, 'subkelas1' => $subkelas1, 'subkelas2' => $subkelas2, 'subkelas3' => $subkelas3, 'status' => $status, 'password' => $password, 'kelamin' => $kelamin);
                 // echo '<br/>';
                 // print_r($data);
                 //insert to table
                 $this->db->insert('siswa', $data);
             }
             echo 'Berhasil Import Data Siswa <a href="' . site_url("admin/siswa") . '">kembali</a>';
         }
     } else {
         echo 'XLS Not Found!';
     }
 }
开发者ID:eandriyas,项目名称:SMAN-01-Depok-Babarsari-Sosial-Version-1.0,代码行数:56,代码来源:admin.php



注:本文中的Spreadsheet_Excel_Reader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Spreadsheet_Excel_Writer类代码示例发布时间:2022-05-23
下一篇:
PHP Spotter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap