// tp 安装 相关插件 composer require phpoffice/phpspreadsheet // ↓↓↓↓↓ 使用内容 //读取 模板
$filename = ROOT_PATH . 'public' . config('importTemplate')['counselor']; $objPHPExcel = PHPExcel_IOFactory::load($filename); // 机构信息管理 $enterModel = new Enter(); $eterArr = $enterModel->getEnterDataByWhere(['record_status' => 0], 'id,enter_name'); foreach ($eterArr as $i => $v) { $objPHPExcel->setActiveSheetIndex(1)->setCellValue('A' . ($i + 2), $v['enter_name']); } // 擅长领域 $configContDomain = config('contDomain'); unset($configContDomain[0]); foreach ($configContDomain as $i => $v) { $objPHPExcel->setActiveSheetIndex(2)->setCellValue('A' . ($i + 1), $v); } // 咨询分类二级 $labelModel = new Label(); $labelArr = $labelModel->getLabelDataByWhere(['label_level' => 2, 'record_status' => 0], 'label_name'); for