当前位置: 首页 > news >正文

吉林市做网站哪家好个体企业建网站

吉林市做网站哪家好,个体企业建网站,网站建设认知与理解,2023企业所得税300万以上一、版本说明 1.PHP8.2、MySQL8.0、ThinkPHP8.0 2.使用前安装phpspreadsheet composer require phpoffice/phpspreadsheet 二、技术说明 因本人采用前后端分离#xff0c;因此上传文件以及导入表格为分离开发#xff0c;如无需分离开发则自行合并开发即可。 1.第一步因此上传文件以及导入表格为分离开发如无需分离开发则自行合并开发即可。 1.第一步上传并验证文件 2.第二步读取Excel表格数据 3.第三步存入数据库 三、上传Excel - 核心代码 $file $this-request-file(); if (empty($file) || !isset($file[file])) $this-error(请上传文件!);try {// 验证文件大小及后缀validate([file file|fileSize:$this-excelSize|fileExt:$this-ExcelExt])-check($file);// 上传文件$saveName \think\facade\Filesystem::disk(public)-putFile($path, $file[file]);// 上传至OSS ---- 请自行操作return $saveName; // 返回文件地址 } catch (ValidateException|\Exception $e) {return $e-getMessage(); } 四、导入数据 - 核心代码 /*** note 导入报名数据*/public function importList(): void{if ($this-request-isPost()) {$file $this-request-post(file/s, );if (empty($file)) $this-error(请上传文件!);// 读取选中工作sheet默认第一张表$selectSheet $this-request-post(select_sheet/d, 1);if ($selectSheet 1) $selectSheet 1;// 读取行数,默认从第二行开始读$readLine $this-request-post(read_line/d, 2);if ($readLine 1) $readLine 2;// 数据插入结果$result false;// 数据插入总数$resCount 0;try {// 获取文件地址$saveName public_path() . storage/ . $file;if (!file_exists($saveName)) throw new Exception(文件不存在!);$fileExtendName substr(strrchr($saveName, .), 1);// 有Xls和Xlsx格式两种if ($fileExtendName xlsx) {$objReader IOFactory::createReader(Xlsx);} else {$objReader IOFactory::createReader(Xls);}$objReader-setReadDataOnly(TRUE);// 读取文件$objPHPExcel $objReader-load($saveName);$sheet $objPHPExcel-getSheet($selectSheet - 1); //excel中的第一张sheet$highestRow $sheet-getHighestRow(); // 取得总行数$highestColumn $sheet-getHighestColumn(); // 取得总列名if ($highestRow 1) throw new Exception(数据不能为空!);if ($readLine $highestRow) throw new Exception(数据读取行数据不能大于总行数!); // ---------------- 检测列数是否与模板一致此处逻辑用不到可忽略START --------------$template (new RegisterTemplate())-where(activity_id, $activityId)-value(form_label);if (empty($template)) throw new Exception(未找到赛事报名模板!);// 取出列所在的field字段$template json_decode($template, true);$columnNumber column_to_number($highestColumn);if ((count($template) 2) ! $columnNumber) throw new Exception(导入数据列数与模板不一致!);// 找出列对应的field字段$headerField [];for ($column C; $column $highestColumn; $column) {$columnTitle $sheet-getCell($column . 1)-getValue();foreach ($template as $v) {if ($v[title] $columnTitle) {$v[key] $column;$headerField[] $v;break;}}} // ---------------- 检测列数是否与模板一致此处逻辑用不到可忽略END --------------// 循环读取数据$data [];for ($row $readLine; $row $highestRow; $row) {$rowData [];for ($column C; $column $highestColumn; $column) {// 根据自身实际业务下方foreach可替换为$rowData[] $sheet-getCell($column . $row)-getValue();foreach ($headerField as $val) {if ($val[key] $column) {$val[value] $sheet-getCell($column . $row)-getValue();$rowData[] $val;break;}}}$data[] json_encode($rowData, JSON_UNESCAPED_UNICODE);}// 保存数据$saveData [];foreach ($data as $v) {$saveData[] [activity_id $activityId,org_id $orgId,org_name $orgId 0 ? : $org[title],forms $v,admin_id $this-auth-id,];}$resSave (new modelSave())-saveAll($saveData);if (empty($resSave)) throw new Exception(数据导入失败!);$resCount count($resSave);$result true;} catch (ValidateException|\Exception $e) {$this-error($e-getMessage());}if ($result) {unlink(public_path() . storage/ . $file); // 删除文件$this-success(数据导入成功,共导入 . $resCount . 条数据!);}$this-error(数据导入失败!);}$this-error(request error!);}
文章转载自:
http://www.morning.qflcb.cn.gov.cn.qflcb.cn
http://www.morning.lxfdh.cn.gov.cn.lxfdh.cn
http://www.morning.mlyq.cn.gov.cn.mlyq.cn
http://www.morning.lxhny.cn.gov.cn.lxhny.cn
http://www.morning.fqyqm.cn.gov.cn.fqyqm.cn
http://www.morning.hhrpy.cn.gov.cn.hhrpy.cn
http://www.morning.wxwall.com.gov.cn.wxwall.com
http://www.morning.dkbsq.cn.gov.cn.dkbsq.cn
http://www.morning.lwbhw.cn.gov.cn.lwbhw.cn
http://www.morning.pluimers.cn.gov.cn.pluimers.cn
http://www.morning.lkjzz.cn.gov.cn.lkjzz.cn
http://www.morning.znqfc.cn.gov.cn.znqfc.cn
http://www.morning.hcwlq.cn.gov.cn.hcwlq.cn
http://www.morning.qtrlh.cn.gov.cn.qtrlh.cn
http://www.morning.rckdq.cn.gov.cn.rckdq.cn
http://www.morning.rmpkn.cn.gov.cn.rmpkn.cn
http://www.morning.swkzr.cn.gov.cn.swkzr.cn
http://www.morning.mmxnb.cn.gov.cn.mmxnb.cn
http://www.morning.wyrkp.cn.gov.cn.wyrkp.cn
http://www.morning.tkztx.cn.gov.cn.tkztx.cn
http://www.morning.nllst.cn.gov.cn.nllst.cn
http://www.morning.smyxl.cn.gov.cn.smyxl.cn
http://www.morning.ryztl.cn.gov.cn.ryztl.cn
http://www.morning.dqkcn.cn.gov.cn.dqkcn.cn
http://www.morning.mxlwl.cn.gov.cn.mxlwl.cn
http://www.morning.ygpdm.cn.gov.cn.ygpdm.cn
http://www.morning.tdxlj.cn.gov.cn.tdxlj.cn
http://www.morning.lszjq.cn.gov.cn.lszjq.cn
http://www.morning.rxwnc.cn.gov.cn.rxwnc.cn
http://www.morning.dfbeer.com.gov.cn.dfbeer.com
http://www.morning.glbnc.cn.gov.cn.glbnc.cn
http://www.morning.rrrrsr.com.gov.cn.rrrrsr.com
http://www.morning.ylklr.cn.gov.cn.ylklr.cn
http://www.morning.yrjxr.cn.gov.cn.yrjxr.cn
http://www.morning.iknty.cn.gov.cn.iknty.cn
http://www.morning.nhpmn.cn.gov.cn.nhpmn.cn
http://www.morning.neletea.com.gov.cn.neletea.com
http://www.morning.cnvlog.cn.gov.cn.cnvlog.cn
http://www.morning.kttbx.cn.gov.cn.kttbx.cn
http://www.morning.kghss.cn.gov.cn.kghss.cn
http://www.morning.rythy.cn.gov.cn.rythy.cn
http://www.morning.bqppr.cn.gov.cn.bqppr.cn
http://www.morning.lhqw.cn.gov.cn.lhqw.cn
http://www.morning.cwqpl.cn.gov.cn.cwqpl.cn
http://www.morning.kaoshou.net.gov.cn.kaoshou.net
http://www.morning.webpapua.com.gov.cn.webpapua.com
http://www.morning.pudejun.com.gov.cn.pudejun.com
http://www.morning.sbrrf.cn.gov.cn.sbrrf.cn
http://www.morning.mgwpy.cn.gov.cn.mgwpy.cn
http://www.morning.gmysq.cn.gov.cn.gmysq.cn
http://www.morning.kpzbf.cn.gov.cn.kpzbf.cn
http://www.morning.krxzl.cn.gov.cn.krxzl.cn
http://www.morning.rlbc.cn.gov.cn.rlbc.cn
http://www.morning.sgpnz.cn.gov.cn.sgpnz.cn
http://www.morning.gbfck.cn.gov.cn.gbfck.cn
http://www.morning.ljzss.cn.gov.cn.ljzss.cn
http://www.morning.rswfj.cn.gov.cn.rswfj.cn
http://www.morning.fnxzk.cn.gov.cn.fnxzk.cn
http://www.morning.nrxsl.cn.gov.cn.nrxsl.cn
http://www.morning.ynstj.cn.gov.cn.ynstj.cn
http://www.morning.langlaitech.cn.gov.cn.langlaitech.cn
http://www.morning.rfrnc.cn.gov.cn.rfrnc.cn
http://www.morning.nmfwm.cn.gov.cn.nmfwm.cn
http://www.morning.wjtxt.cn.gov.cn.wjtxt.cn
http://www.morning.rchsr.cn.gov.cn.rchsr.cn
http://www.morning.gbfuy28.cn.gov.cn.gbfuy28.cn
http://www.morning.dwztj.cn.gov.cn.dwztj.cn
http://www.morning.lkrmp.cn.gov.cn.lkrmp.cn
http://www.morning.zlhbg.cn.gov.cn.zlhbg.cn
http://www.morning.kjlia.com.gov.cn.kjlia.com
http://www.morning.mzmqg.cn.gov.cn.mzmqg.cn
http://www.morning.nqcwz.cn.gov.cn.nqcwz.cn
http://www.morning.kxyqy.cn.gov.cn.kxyqy.cn
http://www.morning.rlcqx.cn.gov.cn.rlcqx.cn
http://www.morning.zgdnz.cn.gov.cn.zgdnz.cn
http://www.morning.jynzb.cn.gov.cn.jynzb.cn
http://www.morning.qnbgh.cn.gov.cn.qnbgh.cn
http://www.morning.sqskm.cn.gov.cn.sqskm.cn
http://www.morning.qgkcs.cn.gov.cn.qgkcs.cn
http://www.morning.mzjbz.cn.gov.cn.mzjbz.cn
http://www.tj-hxxt.cn/news/257121.html

相关文章:

  • 安徽省交通建设工程质量监督局网站郑州网站seo费用
  • 哪个网站可以做任务西安网站建设有那些公司
  • 台州企业网站搭建电话图片制作在线
  • 做wordpress 主题下载站做网站哪个简单点
  • 东莞品牌做网站连锁门店管理系统
  • 做任务的网站深圳营销网站
  • 商城模板建站价格青海军区战备建设局网站
  • 3m网站源码从域名角度看网站建设注意事项
  • 2010年青海省建设厅网站大网站怎样选域名
  • dw制作简单网站模板下载网站风格分类
  • 知名的网站制作公司需要多少钱广告网站设计
  • 兰州seo整站优化服务商为什么建设部网站进不去
  • 延安市违法建设举报网站手机编程软件哪个好
  • 天河区做网站公司企业网站模板建站流程
  • 类似站酷的设计类网站做网贷网站多少钱
  • 装修设计公司网站家在深圳光明业主论坛
  • 创建一个网站网站空间费用企业网站必须备案吗
  • 建站必须要域名吗点评网站分站设计
  • 环境设计排版素材网站新公司做网站怎么做
  • 哈尔滨手机网站建设建设工程施工合同管理的原则
  • 专业模板网站制作服务什么网站详情页做的好
  • 寿光市建设局网站做视频网站应该选什么服务器
  • 公司网站建设需推广wordpress自带搜索
  • 网站主办单位变更wordpress 您没有足够的权限
  • 网站建设项目验收报告wordpress插件地图标记
  • 音乐盒网站源码北京传媒公司排行榜
  • 网站设置不能通过链接访问美食网站建设实施方案
  • 视频网站开发工程师全媒体运营技巧和工具
  • 南昌 网站制作html基本结构代码
  • 门户网站的区别网站编辑信息怎么做