<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ### Excel 導入 2018-3-3 需要結合 UploadTools 上傳類完成導入操作 **位置:** Common\Tools\ExcelTools.class.php **參數:** * @param $file_path string 文件上傳后的路徑 * @param $ext string 文件后綴 如:.xls **調用:** ~~~ use Common\Tools\UploadTools; // 調用封裝 Upload 上傳類 use Common\Tools\ExcelTools; // 調用封裝 Excel 操作類 public function import() { $upload = new UploadTools(); $info = $upload->saveFile(); // 上傳文件 if (!$info) { $this->error($upload->getError()); } $path = APP_ROOT . $info['file_path']; // 文件上傳的路徑 $e = new ExcelTools(); $data = $e->importExcel($path, $info['ext']); // 讀取Excel內容 dump($data); } ~~~ **完整代碼:** ~~~ /* * 導入Excel * * jig 2018-3-3 * @param $file_path string 文件上傳后的路徑 * @param $ext string 文件后綴 如:.xls * return array; */ public function importExcel($file_path, $ext) { if (!is_file($file_path)) { return false; } if ($ext == 'xls') { $excelReader = \PHPExcel_IOFactory::createReader('Excel5'); } else { $excelReader = \PHPExcel_IOFactory::createReader('Excel2007'); } $excelReader->setReadDataOnly(true); $excelObj = $excelReader->load($file_path); $sheet = $excelObj->getActiveSheet(); $row_num = $sheet->getHighestRow(); $column_num = $sheet->getHighestColumn(); $index = \PHPExcel_Cell::columnIndexFromString($column_num); $data = array(); for ($row = 1; $row <= $row_num; ++$row) { $row_arr = array(); $is_empty_row = 0; for($col = 0; $col < $index; ++$col) { $cell = trim($sheet->getCellByColumnAndRow($col, $row)->getCalculatedValue()); if ((!empty($cell) || $cell != "") && $is_empty_row == 0) { $is_empty_row = 1; } if (is_numeric($cell) && stripos($cell, '.')) { $cell = $cell; //$cell = number_format($cell, 2, '.', ''); } array_push($row_arr, $cell); } if($is_empty_row == 1) { array_push($data, $row_arr); } } return $data; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看