我正在做一个项目,我需要将数据从 excelsheet 导入数据库。
当我执行 excelsheet 时,它工作正常,并且 excelsheet 中的数据
已成功导入到数据库表中,但在代码执行时会显示一条消息。
代码运行良好,但在运行时显示一条消息::
ZipArchive Object ( [status] => 0 [statusSys] => 0 [numFiles] => 11 [filename] => C:\xampp\htdocs\bitcoinreports\uploads\data123.xlsx [comment] => )
这是控制器的代码::
public function execute_excel(){
if(!empty($_POST)){
$file_name = $_FILES['report_file']['name'];
$this->load->library('excel');
ini_set('memory_limit', '-1');
//According to me the problem is occur because of below given 4 lines of code
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objReader->setReadDataOnly(true);
$path = $_SERVER['DOCUMENT_ROOT'] . '/bitcoinreports/uploads/'.$file_name;
$objPHPExcel = PHPExcel_IOFactory::load($path);
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$arrayCount = count($allDataInSheet);
for($i=2; $i<=$arrayCount; $i++){
$name = $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();
$email = $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();
$phone = $objWorksheet->getCellByColumnAndRow(2,$i)->getValue();
$details = $objWorksheet->getCellByColumnAndRow(3,$i)->getValue();
$location = $objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
$data_user = array(
"name" => $name,"email" => $email ,"phone" => $phone ,"details" => $details ,"location" => $location);
$checkValue=$this->dashboard_model->check_data($name,$email,$phone,$details,$location);
if($checkValue>0)
{
//echo "Some Statement";
}
else{
$this->dashboard_model->add_data($data_user);
}
}
}
$this->session->set_flashdata('success',"Records Inserted SucessFully !!!");
$data['content'] = "admin/upload/execute_report";
$data['title'] = "Execute Reports";
$data['current_open'] = 'execute_excel';
$data['current_page'] = 'result_add';
$this->load->view('admin/dashboard/common', $data);
}
如何解决这个问题呢 ?