本文整理汇总了PHP中Spreadsheet_Excel_Reader::colcount方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::colcount方法的具体用法?PHP Spreadsheet_Excel_Reader::colcount怎么用?PHP Spreadsheet_Excel_Reader::colcount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spreadsheet_Excel_Reader
的用法示例。
在下文中一共展示了Spreadsheet_Excel_Reader::colcount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: data_excel
/**
* Method untuk membaca data pada file excel
*
* @param string $path_file path file excel
* @param integer $baris_mulai_data
* @return array
*/
function data_excel($path_file, $baris_mulai_data = 2)
{
include 'excel_reader2.php';
$file_excel = new Spreadsheet_Excel_Reader($path_file);
# membaca jumlah baris dari data excel
$baris = $file_excel->rowcount($sheet_index = 0);
$kolom = $file_excel->colcount($sheet_index = 0);
$data_return = array();
for ($i = $baris_mulai_data; $i <= $baris; $i++) {
$row_data = array();
for ($k = 1; $k <= $kolom; $k++) {
$row_data[] = $file_excel->val($i, $k);
}
$data_return[] = $row_data;
}
return $data_return;
}
示例3: import
public function import($file)
{
try {
$users = array();
$params = array(1 => 'username', 'password', 'first_name', 'last_name', 'email', 'admin', 'active');
$excel = new Spreadsheet_Excel_Reader($file);
$rows = $excel->rowcount($sheet_index = 0);
$cols = $excel->colcount($sheet_index = 0);
for ($row = 2; $row <= $rows; $row++) {
for ($col = 1; $col <= $cols; $col++) {
$users[$row][$params[$col]] = $excel->val($row, $col);
}
}
$this->userimport = new userimport();
$users = $this->userimport->import($users);
$_SESSION['message'] = $this->userimport->get_message();
return $users;
} catch (Exception $e) {
display_page_error();
}
}
示例4: importToExistingTable
function importToExistingTable($file, $tableName)
{
$data = new Spreadsheet_Excel_Reader($file);
$colcount = $data->colcount();
$rowcount = $data->rowcount();
//This gets the field names in the database so that they can be confirmed as matching those in the spreadsheet:
$sql = mysql_query("SELECT * FROM `{$tableName}`");
for ($no = 0; $no <= $colcount; $no++) {
$tableColsArray[$no] = mysql_field_name($sql, $no);
}
//This goes through the spreadsheet and compares the columns with those in the database:
for ($colno = 1; $colno <= $colcount; $colno++) {
$cell = $data->value(1, $colno);
if ($tableColsArray[$colno] != $cell) {
die("Column {$colno} does not match its counterpart in the database");
} else {
echo "spreadsheet part ({$cell}) perfectly matches db part ({$tableColsArray[$colno]})<br />";
}
}
//This goes through the whole sheet building the insert statement from the data:
$actualInserts = 0;
for ($rowno = 2; $rowno <= $rowcount; $rowno++) {
$sql = "INSERT INTO `{$tableName}` (";
for ($no = 1; $no < count($tableColsArray); $no++) {
$sql = $sql . "`{$tableColsArray[$no]}`,";
}
$sql = substr($sql, 0, -1) . ") VALUES (";
for ($colno = 1; $colno <= $colcount; $colno++) {
$sql = $sql . "'" . mysql_real_escape_string($data->value($rowno, $colno)) . "',";
}
$sql = substr($sql, 0, -1) . ")";
//This executes the insert and counts the successful inserts:
if (!mysql_query($sql)) {
echo mysql_error();
} else {
$actualInserts++;
}
}
echo "<br />" . $actualInserts . " rows inserted";
}
示例5: Lama
vertical-align:bottom;
}
table.excel tbody td {
padding: 0 3px;
border: 1px solid #EEEEEE;
}
</style>
</head>
<body>
<?php
echo "DATA BERHASIL TERSIMPAN KE DALAM DATABASE<br/>";
echo "STATISTIK DATA FILE<br/>";
echo "=============================<br/>";
echo "Jumlah Baris : " . $data->rowcount(0) . "<br/>";
echo "Jumlah Kolom : " . $data->colcount(0) . "<br/><br/>";
echo "<table border='1' cellpadding='3' cellspacing='1' style='width:100%;'>";
echo "<tr>";
echo "<td>No</td>";
echo "<td>No Persetujuan BKN</td>";
echo "<td>TGL Persetujuan BKN</td>";
echo "<td>NIP</td>";
echo "<td>Pendidikan</td>";
echo "<td>TMT Lama</td>";
echo "<td>MKG Lama (Tahun)</td>";
echo "<td>MKG Lama (Bulan)</td>";
echo "<td>Gaji Pokok Lama</td>";
echo "<td>Jabatan</td>";
echo "<td>TMT Baru</td>";
echo "<td>MKG Baru (Tahun)</td>";
echo "<td>MKG Baru (Bulan)</td>";
示例6: importexcel
public function importexcel()
{
$fileupload = $_FILES['fileexcel']['tmp_name'];
$namafile = $_FILES['fileexcel']['name'];
$path = 'assets/resources/data/';
$pathfile = $path . $namafile;
$orgid = $this->my_usession->userdata('user_dept') != '' ? $this->employe_model->deptonall(explode(',', $this->my_usession->userdata('user_dept'))) : array();
$holiday = $this->roster_model->holiday($orgid);
$holarray = array();
foreach ($holiday->result() as $hol) {
$tglmulai = strtotime($hol->startdate);
$tglselesai = strtotime($hol->enddate);
$selisih = $tglselesai - $tglmulai;
if ($selisih == 0) {
$holarray[] = $hol->startdate;
} else {
$jarak = $selisih / 86400;
for ($k = 0; $k <= $jarak; $k++) {
$holarray[] = date('Y-m-d', strtotime($hol->startdate) + $k * 86400);
}
}
}
if (move_uploaded_file($fileupload, $pathfile)) {
include_once APPPATH . "libraries/excelreader.php";
$data = new Spreadsheet_Excel_Reader($pathfile);
$blth = $data->val(2, 2) . '-' . date('m', strtotime($data->val(1, 2)));
$usernik = $this->roster_model->getuseridfromnik();
foreach ($usernik->result() as $useridfromnik) {
$array[$useridfromnik->userid] = array('name' => $useridfromnik->name, 'group' => $useridfromnik->deptid);
}
$a = array();
$datagagal = '';
$nonik = 0;
for ($i = 5; $i <= $data->rowcount($sheet_index = 0); $i++) {
$nik = $data->val($i, 1);
if ($nik != '') {
if (isset($array[$nik])) {
$userid = $nik;
$name = $array[$nik]['name'];
$group = $array[$nik]['group'];
$data_arr = array('userid' => $userid, 'name' => $name, 'group' => $group);
$tgla = '';
$tanggal = strtotime($blth . '-' . $data->val(3, 3));
for ($j = 3; $j <= $data->colcount($sheet_index = 0); $j++) {
$tgla .= $tanggal + ($j - 3) * 86400 . "\t";
$tglan = $tanggal + ($j - 3) * 86400;
$shift[$j] = $data->val($i, $j);
if ($shift[$j] != '') {
$savedata = array('userid' => $userid, 'rosterdate' => date('Y-m-d', $tglan), 'absence' => $shift[$j]);
$data_arr[$tglan] = $shift[$j];
} else {
$data_arr[$tglan] = $shift[$j];
}
}
$fieldarr[] = $data_arr;
} else {
$datagagal = $datagagal . $nik . ', ';
}
} else {
$nonik++;
}
}
$fp = fopen('assets/js/template/roster_' . $this->my_usession->userdata('user_id') . '.json', 'w');
fwrite($fp, json_encode(array('data' => $fieldarr)));
fclose($fp);
if (strpos($datagagal, ',') !== false) {
$datagagal = substr($datagagal, 0, -2);
}
$tgl = "userid\tname\t";
$tglan = explode("\t", $tgla);
$count = count($tglan);
for ($i = 0; $i < $count - 1; $i++) {
if (in_array(date('Y-m-d', $tglan[$i]), $holarray)) {
$tgl .= $tglan[$i] . "#\t";
} else {
$tgl .= $tglan[$i] . "\t";
}
}
$actionlog = array('user' => $this->my_usession->userdata('username'), 'ipadd' => $this->ipaddress->get_ip(), 'logtime' => date("Y-m-d H:i:s"), 'logdetail' => 'Import roster', 'info' => $this->lang->line('message_success'));
$this->db->insert('actionlog', $actionlog);
$hasil = array("responseText" => "success", "success" => true, "tglawal" => $tglan[0], "tglakhir" => $tglan[$count - 2], "datagagal" => $datagagal, "nonik" => $nonik, "field" => $tgl);
echo json_encode($hasil);
} else {
$hasil = array("responseText" => $this->lang->line('message_failimport'), "success" => false);
echo json_encode($hasil);
}
}
示例7: fopen
/* get file to string */
$filehdl = fopen('upload/data_import.csv', 'r');
$data = fgets($filehdl);
fclose($filehdl);
/* format file */
$data = str_replace(array("\r\n", "\r"), "", $data);
//remove line break
$data = preg_split("/[;,]/", $data);
//split by comma or semi-colon
foreach ($data as $col) {
$firstrow[] = $col;
}
} elseif (strtolower($filetype) == "xls") {
# get excel object
require_once dirname(__FILE__) . '/../../../functions/php-excel-reader/excel_reader2.php';
//excel reader 2.21
$data = new Spreadsheet_Excel_Reader('upload/data_import.xls', false);
$sheet = 0;
$row = 1;
for ($col = 1; $col <= $data->colcount($sheet); $col++) {
$firstrow[] = $data->val($row, $col, $sheet);
}
}
echo '{"status":"success","expfields":' . json_encode($expfields, true) . ',"impfields":' . json_encode($firstrow, true) . ',"filetype":' . json_encode($filetype, true) . '}';
exit;
}
}
}
/* default - error */
echo '{"status":"error","error":"Empty file"}';
exit;
示例8: sizeof
replay_move_uploaded_file($filename);
$html = file_get_html("../uploadstand/" . $filename);
$standtable = $html->find("table.monitor", 0);
$nprob = sizeof($standtable->find("tr", 0)->children()) - 5;
if ($nprob != $pnum) {
$ret["msg"] = "Expected " . $nprob . " problems, got {$pnum} . Add failed.";
die(json_encode($ret));
}
replay_add_contest();
replay_deal_ural($standtable);
} else {
if ($_POST["ctype"] == "zju") {
$filename = "replay_cid_" . $mcid . ".xls";
replay_move_uploaded_file($filename);
$data = new Spreadsheet_Excel_Reader("../uploadstand/" . $filename);
if ($pnum != $data->colcount() - 5) {
$ret["msg"] = "Expected " . ($data->colcount() - 5) . " problems, got {$pnum} . Add failed.";
die(json_encode($ret));
}
replay_add_contest();
replay_deal_zju($data);
} else {
if ($_POST["ctype"] == "jhinv") {
$filename = "replay_cid_" . $mcid . ".html";
replay_move_uploaded_file($filename);
$html = file_get_html("../uploadstand/" . $filename);
$standtable = $html->find("#standings", 0);
$nprob = sizeof($standtable->find("tr", 0)->children()) - 7;
if ($nprob != $pnum) {
$ret["msg"] = "Expected " . $nprob . " problems, got {$pnum} . Add failed.";
die(json_encode($ret));
示例9: trim
# read each row into a dictionary with expected fields as keys
$record[$fieldmap[$col]] = trim($val);
}
}
$data[] = $record;
}
fclose($filehdl);
} elseif (strtolower($filetype) == "xls") {
# get excel object
require_once dirname(__FILE__) . '/../../../functions/php-excel-reader/excel_reader2.php';
//excel reader 2.21
$xls = new Spreadsheet_Excel_Reader('upload/data_import.xls', false);
$sheet = 0;
$row = 1;
# map import columns to expected fields as per previous window
for ($col = 1; $col <= $xls->colcount($sheet); $col++) {
$fieldmap[$col] = $impfields[$xls->val($row, $col, $sheet)];
$hcol = $col;
}
# read each remaining row into a dictionary with expected fields as keys
for ($row = 2; $row <= $xls->rowcount($sheet); $row++) {
$record = array();
for ($col = 1; $col <= $xls->colcount($sheet); $col++) {
$record++;
if ($col > $hcol) {
$Result->show('danger', _("Extra column found on line ") . $row . _(" in XLS file. Please check input file."), true);
} else {
$record[$fieldmap[$col]] = trim($xls->val($row, $col, $sheet));
}
}
$data[] = $record;
示例10: time
if (in_array($extension, $allowed_extensions)) {
$source = $_FILES['file']['tmp_name'];
$t = "Subjective" . time() . "" . date('Ymd') . ".xls";
$target = $upload_path . "/" . $t;
$tempUploadedValue = move_uploaded_file($source, $target);
if ($tempUploadedValue) {
/* echo "<script type='text/javascript'> alert('test1'); </script>"; */
if (($handle = fopen($upload_path . '/' . $t, "r")) !== false) {
$_FILES['file']['name'];
$expiryDate = $_POST['expiryDate'];
$data = new Spreadsheet_Excel_Reader($upload_path . '/' . $t);
$data->dump(true, true);
$data_array = array();
for ($i = 1; $i <= $data->rowcount(); $i++) {
$data_array[$i] = array();
for ($j = 1; $j <= $data->colcount(); $j++) {
$data_array[$i][$j] = $data->val($i, $j);
}
// inner For
}
// outer For
$myFile = $t;
$url = "./excelfiles/" . $t;
$newUploadedQuizURL = $newBaseURL . "/excelfiles/" . str_replace(' ', '%20', $myFile);
$newQuizName = $_POST['questionFileName'];
$newQuizFileName = $myFile;
$duration = $_POST['hours'] * 3600 + $_POST['minutes'] * 60;
$questionWeightage = $_POST['questionWeightage'];
$questionQty = $_POST['questionQty'];
$re_exam_date = $_POST['re_exam_date'];
$cut_off = $_POST['cut_off'];
示例11: _handleDataset
function _handleDataset($fileName)
{
global $startYear;
global $endYear;
global $vocab;
global $regions;
global $subRegions;
global $countries;
global $propURIs;
$data = new Spreadsheet_Excel_Reader($fileName);
$datasetName = str_replace('data/', '', $fileName);
$datasetName = str_replace('.xls', '', $fileName);
$datasetComment = null;
$datasetURI = URI_BASE . 'dataset/' . urlencode($datasetName);
$slices = array();
$rdfData = array();
$sheetCount = count($data->boundsheets);
for ($i = 0; $i < $sheetCount; ++$i) {
$rowCount = $data->rowcount($i);
$colCount = $data->colcount($i);
$sheetTitle = $data->boundsheets[$i]['name'];
$currentRow = 0;
$currentRegion = null;
$currentSubRegion = null;
$sliceTitle = null;
// Search for slice title
for ($row = 0; $row < $rowCount; ++$row) {
for ($col = 0; $col < $colCount; ++$col) {
$cellValue = $data->val($row, $col, $i);
if ($cellValue !== '') {
$sliceTitle = trim($cellValue);
$currentRow = $row + 1;
break 2;
}
}
}
// Search for dataset definition
for ($row = $currentRow; $row < $rowCount; ++$row) {
for ($col = 0; $col < $colCount; ++$col) {
$cellValue = $data->val($row, $col, $i);
if ($cellValue !== '') {
if (strpos(strtolower($cellValue), 'definition:') !== false) {
$datasetComment = trim($cellValue);
$currentRow = $row + 1;
break 2;
}
}
}
}
// Search for start of data
for ($row = $currentRow; $row < $rowCount; ++$row) {
$cellValue = $data->val($row, 1, $i);
if ($cellValue !== '') {
$currentRow = $row + 1;
break;
}
}
$sheetInstances = array();
for ($row = $currentRow; $row < $rowCount; ++$row) {
if ($data->val($row, 3, $i) === '') {
// We break, if col 3 is empty (country), since all data rows have a country!
break;
}
$region = $data->val($row, 1, $i);
if ($region === '') {
$region = $currentRegion;
} else {
// new region... store it
$regions[$region] = $region;
}
$subRegion = $data->val($row, 2, $i);
if ($subRegion === '') {
$subRegion = $currentSubRegion;
} else {
// new subregion... store it
$subRegions[$subRegion] = $currentRegion;
}
$country = $data->val($row, 3, $i);
$countries[$country] = $subRegion;
$countValues = array();
// Now the values for count
$currentCol = 4;
for ($j = $startYear; $j <= $endYear; ++$j) {
$val = $data->val($row, $currentCol++, $i);
if ($val != '-1' && $val != '') {
$countValues[$j] = floatval(str_replace(',', '.', $val));
}
}
$rateValues = array();
$currentCol++;
for ($j = $startYear; $j <= $endYear; ++$j) {
$val = $data->val($row, $currentCol++, $i);
if ($val != '-1' && $val != '') {
$rateValues[$j] = floatval(str_replace(',', '.', $val));
}
}
$regionURI = URI_BASE . 'region/' . urlencode($region);
$subRegionURI = URI_BASE . 'subregion/' . urlencode($subRegion);
$countryURI = URI_BASE . 'country/' . urlencode($country);
$countPropURI = $vocab['unodc'] . strtolower($datasetName) . urlencode(ucfirst(strtolower($sheetTitle))) . 'Count';
//.........这里部分代码省略.........
示例12: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new PhoneModel();
$message = "";
$errorList = array();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['source_name'], $_POST['group_id'])) {
$fileName = _APP_PATH_ . DS . "data" . DS . "tmp" . DS . $_POST['source_name'];
$group_id = $_POST['group_id'];
//$fileName = "D:\\chacha_cloud\\src\\trunk\chacha\data\\tmp\\20120713170547_phone_list.xls";
try {
require_once 'excel_reader2.php';
$data = new Spreadsheet_Excel_Reader($fileName, true, "UTF-8");
// khoi tao doi tuong doc file excel
$rowsnum = $data->rowcount($sheet_index = 0);
// lay so hang cua sheet
$colsnum = $data->colcount($sheet_index = 0);
// lay so cot cua sheet
for ($i = 2; $i <= $rowsnum; $i++) {
// doc tu hang so 2 vi hang 1 la tieu de roi!
$phoneNum = $data->val($i, 1);
// xuat cot so 1 va cot so 2 tren cung 1 hang
// check so dien thoai xem co dung cua Vinaphone ko
try {
$phoneNum = Formatter::formatPhone($phoneNum);
if (Formatter::isVinaphoneNumber($phoneNum)) {
$model->phone = "{$phoneNum}";
$model->group_id = $group_id;
$model->status = 0;
$model->created_time = date("Y-m-d H:i:s");
var_dump($model->phone);
try {
if ($model->save()) {
$message = yii::t('SpamModule', 'Upload thành công');
} else {
print_r($model->getErrors());
exit;
}
} catch (Exception $exc) {
echo $exc->getTrace();
}
} else {
//echo so dien thoai ko dung
$errorList[] = $phoneNum;
}
} catch (Exception $exc) {
echo $exc->getMessage();
}
}
} catch (Exception $exc) {
echo $exc->getMessage();
}
}
$uploadModel = new XUploadForm();
$tmpArr = GroupModel::model()->findAll();
$smsGroup = array();
foreach ($tmpArr as $smsG) {
$smsGroup[$smsG->id] = $smsG->name;
}
$this->render('create', array('model' => $model, 'uploadModel' => $uploadModel, 'message' => $message, 'smsGroup' => $smsGroup, 'errorList' => $errorList));
}
示例13: null_2_default
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
echo "Error selecting database, exited.";
exit;
}
function null_2_default($string, $default)
{
return isset($string) && $string != '' ? $string : $default;
}
$current_timestamp = get_GMT(microtime(true));
$current_time = date("Y-m-d H:i:s", $current_timestamp);
$data = new Spreadsheet_Excel_Reader("mls.xls");
$sheet_count = $data->sheetcount();
for ($sheet_index = 0; $sheet_index < $sheet_count; $sheet_index++) {
$row_count = $data->rowcount($sheet_index);
$col_count = $data->colcount($sheet_index);
echo "Sheet:{$sheet_index}<br/>";
echo "Row Count:" . $row_count . "<br/>";
echo "Column Count:" . $col_count . "<br/>";
for ($row_index = 1; $row_index <= $row_count; $row_index++) {
for ($col_index = 1; $col_index <= $col_count; $col_index++) {
if ($row_index > 1 && $col_index <= 3) {
if ($col_index == 1) {
$month = $data->val($row_index, $col_index, $sheet_index) === '' ? $month : $data->val($row_index, $col_index, $sheet_index);
}
if ($col_index == 2) {
$year = $data->val($row_index, $col_index, $sheet_index) === '' ? $year : $data->val($row_index, $col_index, $sheet_index);
}
if ($col_index == 3) {
$property_type = $data->val($row_index, $col_index, $sheet_index) === '' ? $property_type : $data->val($row_index, $col_index, $sheet_index);
}
示例14: array
$data[$keys[$col]] = $book->val($row, $col);
}
}
$data['rownumber'] = $row;
print_r($data);
if ($data['DATE'] != 'DATE' && $data['DATE'] && $data['FLEET NO']) {
$data['DATE'] = DateTime::createFromFormat('d/m/y', $data['DATE'])->format('Y-m-d');
scraperwiki::save(array('rownumber'), $data);
}
}
require_once 'scraperwiki/excel_reader2.php';
$url = "http://www.whatdotheyknow.com/request/82804/response/208592/attach/2/ACCIDENTS%20TRAMS%20Laurderdale.xls";
file_put_contents("/tmp/spreadsheet.xls", scraperWiki::scrape($url));
$book = new Spreadsheet_Excel_Reader("/tmp/spreadsheet.xls");
print $book->rowcount() . "\n";
print $book->colcount() . "\n";
print $book->val(3, 1) . "\n";
print $book->val(3, 'A') . "\n";
for ($col = 1; $col <= $book->colcount(); $col++) {
print $book->val(3, $col) . ",";
}
$keys = array('dummy');
for ($col = 1; $col <= $book->colcount(); $col++) {
$keys[] = str_replace(".", "", $book->val(3, $col));
}
print_r($keys);
for ($row = 1; $row <= $book->rowcount(); $row++) {
for ($col = 1; $col <= $book->colcount(); $col++) {
if ($keys[$col]) {
$data[$keys[$col]] = $book->val($row, $col);
}
示例15: array
<div class="row">
<div class="col-md-12">
<div class="box-header">
<h3 class="box-title">Kết quả Import Excel</h3>
</div><!-- /.box-header -->
<?php
$arrColumn = array('product_code', 'product_name', 'cate_type_id', 'cate_id', 'trangthai', 'price', 'price_saleoff', 'deal_amount', 'start_date', 'end_date', 'da_ban', 'meta_title', 'meta_description', 'meta_keyword');
require_once 'controller/ExcelReader.php';
$dataArr = array();
if ($_FILES['file']['tmp_name']) {
$data = new Spreadsheet_Excel_Reader($_FILES['file']['tmp_name'], true, "UTF-8");
$numCol = $data->colcount();
$rowCol = $data->rowcount();
for ($j = 1; $j <= $numCol; $j++) {
for ($i = 2; $i <= $rowCol; $i++) {
$dataArr[$arrColumn[$j - 1]][] = $data->val($i, $j);
}
}
}
if (!empty($dataArr)) {
$count = count($dataArr['product_code']);
for ($k = 0; $k <= $count; $k++) {
foreach ($arrColumn as $value) {
$dataInsert[$value] = $dataArr[$value][$k];
$dataInsert['name_en'] = $model->stripUnicode($dataArr['product_name'][$k]);
$dataInsert['product_alias'] = $model->changeTitle($dataArr['product_name'][$k]);
$id = $model->getProductIdByCode($dataArr['product_code'][$k]);
if ($id > 0) {
$dataInsert['id'] = $id;
}
}