CI 整合 PHPExcel(注意:PHP7.4以上会报 Array and string offset access syntax with curly braces is deprecated)

注意:PHP7.4以上会报 Array and string offset access syntax with curly braces is deprecated
PHP7.4不再支持使用大括号访问数组以及字符串的偏移_PHP代码
php7.4不支持数组{}写法,统一为数组[]

1,到github下载PHPExcel

2,拷贝Classes中的PHPExcel 文件夹 和 PHPexcel.php 放在项目中的 sw_application\libraries 里面


        $this->load->library('PHPExcel');
        $objPHPExcel = new PHPExcel();
        $objReader = PHPExcel_IOFactory::createReader('Excel2007');
        $objPHPExcel = $objReader->load($fileName);
        $sheet = $objPHPExcel->getSheet(0);
        $highestRow = $sheet->getHighestRow();

        for ($currentRow = 2; $currentRow <= $highestRow; $currentRow++) {
            $Info = $this->Message_Model->NewModel();
            $Info['Model'] = "Report";
            $Info['UserID'] = $this->get_string("ID");
            $Info['UserName'] = $this->get_string("UserName");
            $Info['OrderNo'] = $objPHPExcel->getActiveSheet()->getCell("A" . $currentRow)->getValue();
            $Info['Province'] = $objPHPExcel->getActiveSheet()->getCell("B" . $currentRow)->getValue();
            $Info['Company'] = $objPHPExcel->getActiveSheet()->getCell("C" . $currentRow)->getValue();
            $Info['Name'] = $objPHPExcel->getActiveSheet()->getCell("D" . $currentRow)->getValue();
            $Info['Mobile'] = $objPHPExcel->getActiveSheet()->getCell("E" . $currentRow)->getValue();
            $Info['DealerProvince'] = $objPHPExcel->getActiveSheet()->getCell("F" . $currentRow)->getValue();
            $Info['DealerCompany'] = $objPHPExcel->getActiveSheet()->getCell("G" . $currentRow)->getValue();
            $Info['DealerName'] = $objPHPExcel->getActiveSheet()->getCell("H" . $currentRow)->getValue();
            $Info['DealerEmail'] = $objPHPExcel->getActiveSheet()->getCell("I" . $currentRow)->getValue();
            $Info['DealerMobile'] = $objPHPExcel->getActiveSheet()->getCell("J" . $currentRow)->getValue();
            $Info['TypeNo'] = $objPHPExcel->getActiveSheet()->getCell("K" . $currentRow)->getValue();
            $Info['State'] = $objPHPExcel->getActiveSheet()->getCell("L" . $currentRow)->getValue();
            $Info['AddDate'] = $objPHPExcel->getActiveSheet()->getCell("M" . $currentRow)->getValue();
            $Info['ExpireDate'] = $objPHPExcel->getActiveSheet()->getCell("N" . $currentRow)->getValue();
            $Info['Detail'] = $objPHPExcel->getActiveSheet()->getCell("O" . $currentRow)->getValue();
            $Info['Source'] = $objPHPExcel->getActiveSheet()->getCell("P" . $currentRow)->getValue();
            $Info['SourceType'] = $objPHPExcel->getActiveSheet()->getCell("Q" . $currentRow)->getValue();
            $Info['Address'] = $objPHPExcel->getActiveSheet()->getCell("R" . $currentRow)->getValue();

            $add = $this->Message_Model->Add($Info);
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值