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

玉林市网站建设程序开发培训

玉林市网站建设,程序开发培训,温州网站建设团队,这么登入wordpress在项目根目录安装 composer require phpoffice/phpspreadsheet 我们看一下郊果图#xff0c;如下 点击导入excel表格数据 出现弹窗选择文件#xff0c;控制台打开输出文档内容 前端layui代码 form iduploadForm classform-horizontal encty…在项目根目录安装 composer require phpoffice/phpspreadsheet 我们看一下郊果图如下 点击导入excel表格数据 出现弹窗选择文件控制台打开输出文档内容 前端layui代码 form iduploadForm classform-horizontal enctypemultipart/form-datainput typefile namefile classfile multiplemultiple requiredbutton typebutton idupload classbtn btn-xs btn-purplespan classace-icon fa fa-cloud-upload icon-on-right bigger-110/span上传文件/button /form layui.use([form,layer],function () {$(#input_excel_data).click(function () {// console.log(点击导入了);// layer.msg(点击导入了);layer.open({type: 1,area: [500px, 360px],title: 导入excel文件,content:$(#file_upload_div),});});$(#upload_file).click(function () {//上传文档// var data new FormData;// data.append(file,my_file);// data.append(name,my_file.name);var formData new FormData($(#uploadForm)[0]);$.ajax({type:post,url:user/input_excel_data,contentType:false,processData:false,data:formData,success:function (data) {console.log(data);layer.msg(导入成功);}});}) }); 整个laui页面文件如下 {extend namepublic/layout} {block namecontent} div classlayui-col-md12div classlayui-carddiv classlayui-card-header!-- button classlayui-btn onclickxadmin.open(添加用户组,{:admin_url(admin_user/add)})添加管理员/button --form iduploadForm classform-horizontal enctypemultipart/form-datadiv idfile_upload_div styledisplay: none classtext-centerinput typefile namefile classfile multiplemultiple required !-- button typebutton idupload_file classbtn btn-xs btn-purple-- !--   span classace-icon fa fa-cloud-upload icon-on-right bigger-110/span上传文件-- !--   /button--button typebutton classlayui-btn mt-2 idupload_file开始上传/button/div/form/divdiv classlayui-card-header styleheight:autoform classlayui-form layui-col-space5 idmain-form div classlayui-inline layui-show-xs-block{if isset($params[nickname]) !empty($params[nickname])}input typetext namenickname placeholder用户名 value{$params[nickname]} autocompleteoffclasslayui-input{else /}input typetext namenickname placeholder用户名 value autocompleteoffclasslayui-input{/if}/divdiv classlayui-inline layui-show-xs-block{if isset($params[phone])}input typetext namephone placeholder手机号 value{$params[phone]} autocompleteoffclasslayui-input{else/}input typetext namephone placeholder手机号 value autocompleteoffclasslayui-input{/if}/divdiv classlayui-inline layui-show-xs-blockselect nameenableoption value状态/option{if isset($params[enable])}option value1 {eq name$params[enable] value1}selected{/eq}正常/optionoption value2 {eq name$params[enable] value2}selected{/eq}禁用/option{else/}option value1正常/optionoption value2禁用/option{/if}/select/divdiv classlayui-inline layui-show-xs-blockbutton classlayui-btn lay-submit lay-filtersearchiclasslayui-icon#xe615;/i/buttonbutton classlayui-btn typebutton lay-submitonclicklocation.href location.pathname重置/buttonbutton classlayui-btn typebutton lay-submit onclicklocation.reload()刷新/buttonbutton classlayui-btn typebutton lay-submit idinput_excel_data导入excel表格数据/button/div/form/divdiv classlayui-card-body table classlayui-table layui-formtheadtr!-- thinput typecheckbox name lay-skinprimary/th --th头像/thth手机号/thth昵称/thth性别/thth状态/thth创建时间/thth操作/th/tr/theadtbody{volist namedatalist idvo}tr!-- tdinput typecheckbox name lay-skinprimary /td --tdimg stylewidth: 50px;height: 50px src{$vo[avatar]} alt/tdtd{$vo[phone]}/tdtd{$vo[nickname]}/tdtd{$vo[sex]}/tdtd{$vo[enable]}/tdtd{$vo[create_time]}/tdtd classtd-managebutton onclickxadmin.open(this.innerText,this.dataset.url) data-url{:admin_url(user/edit,[id$vo[id]])} typebutton classlayui-btn编辑/buttonbutton data-url{:admin_url(user/del,[id$vo[id]])} typebutton classlayui-btn layui-btn-danger delete-btn删除/button/td/tr{/volist}/tbody/table/divdiv classlayui-card-body {$datalist-render()|raw}/div/div /div{/block}{block namefoot} script (function(){$(.layui-table).on(click,.delete-btn,function(){var obj this;layer.confirm(确认要删除吗,function(index){//发异步删除数据console.log(obj.dataset)var index layer.load()$.ajax({type:post,url:obj.dataset.url,success:function(data){layer.close(index)layer.alert(data.msg||服务器出现错误,{icon:data.err_code 200?6:5,end:function(){if(data.err_code 200){$($(obj).parents(tr)[0]).remove();}}});}})});}); })();//不添加这个无法显示下拉列表 layui.use(form, function () {}) layui.use([form,layer],function () {$(#input_excel_data).click(function () {// console.log(点击导入了);// layer.msg(点击导入了);layer.open({type: 1,area: [500px, 360px],title: 导入excel文件,content:$(#file_upload_div),});});$(#upload_file).click(function () {//上传文档// var data new FormData;// data.append(file,my_file);// data.append(name,my_file.name);var formData new FormData($(#uploadForm)[0]);$.ajax({type:post,url:user/input_excel_data,contentType:false,processData:false,data:formData,success:function (data) {console.log(data);// layer.msg(导入成功);layer.alert(data.msg,{icon:data.err_code 200?6:5,end:function(){if(data.err_code 200){// 获得frame索引var index parent.layer.getFrameIndex(window.name);//关闭当前frameparent.layer.close(index);parent.location.reload();}}});},error:function(){layer.close(index);layer.alert(服务器出现错误)}});}) });/script {/block} 接下来我们看一看Tp6后台的代码  这是控制器代码需要在控制器中添加引入 use PhpOffice\PhpSpreadsheet\IOFactory; /*** 导入excel文档数据* return \think\response\Json*/function input_excel_data(){$file request()-file(file);if (!$file) {print_r(请选择需要导入的文件);die;}// 加载文件$spreadsheet IOFactory::load($file-getRealPath());$sheet $spreadsheet-getActiveSheet();// 处理文件数据$data [];foreach ($sheet-getRowIterator() as $row) {$rowIndex $row-getRowIndex();// 不读取第一行 标题if ($rowIndex 1) {continue;}$cellIterator $row-getCellIterator();$row [];foreach ($cellIterator as $cell) {$row[] $cell-getValue();}$data[] $row;}// 数据入库处理print_r($data);die;return success_json(导入数据);} 需要添加路由 //上传文档导入excel文档数据 Route::post(productImport, ProductOrder/importExcel);
文章转载自:
http://www.morning.rlksq.cn.gov.cn.rlksq.cn
http://www.morning.knscf.cn.gov.cn.knscf.cn
http://www.morning.skdrp.cn.gov.cn.skdrp.cn
http://www.morning.prjns.cn.gov.cn.prjns.cn
http://www.morning.ykyfq.cn.gov.cn.ykyfq.cn
http://www.morning.khyqt.cn.gov.cn.khyqt.cn
http://www.morning.pqkgb.cn.gov.cn.pqkgb.cn
http://www.morning.wmyqw.com.gov.cn.wmyqw.com
http://www.morning.wjlhp.cn.gov.cn.wjlhp.cn
http://www.morning.mgzjz.cn.gov.cn.mgzjz.cn
http://www.morning.yrxcn.cn.gov.cn.yrxcn.cn
http://www.morning.fbbpj.cn.gov.cn.fbbpj.cn
http://www.morning.gqfbl.cn.gov.cn.gqfbl.cn
http://www.morning.zlfxp.cn.gov.cn.zlfxp.cn
http://www.morning.xyrss.cn.gov.cn.xyrss.cn
http://www.morning.rqnzh.cn.gov.cn.rqnzh.cn
http://www.morning.hslgq.cn.gov.cn.hslgq.cn
http://www.morning.hwxxh.cn.gov.cn.hwxxh.cn
http://www.morning.ymwny.cn.gov.cn.ymwny.cn
http://www.morning.yhyqg.cn.gov.cn.yhyqg.cn
http://www.morning.nkbfc.cn.gov.cn.nkbfc.cn
http://www.morning.jgcrr.cn.gov.cn.jgcrr.cn
http://www.morning.qrgfw.cn.gov.cn.qrgfw.cn
http://www.morning.rwlns.cn.gov.cn.rwlns.cn
http://www.morning.ffksr.cn.gov.cn.ffksr.cn
http://www.morning.fmkbk.cn.gov.cn.fmkbk.cn
http://www.morning.tqdqc.cn.gov.cn.tqdqc.cn
http://www.morning.wqpm.cn.gov.cn.wqpm.cn
http://www.morning.sjzsjsm.com.gov.cn.sjzsjsm.com
http://www.morning.zcwtl.cn.gov.cn.zcwtl.cn
http://www.morning.elmtw.cn.gov.cn.elmtw.cn
http://www.morning.hhfwj.cn.gov.cn.hhfwj.cn
http://www.morning.fpyll.cn.gov.cn.fpyll.cn
http://www.morning.nfzzf.cn.gov.cn.nfzzf.cn
http://www.morning.qtwd.cn.gov.cn.qtwd.cn
http://www.morning.wqhlj.cn.gov.cn.wqhlj.cn
http://www.morning.qypjk.cn.gov.cn.qypjk.cn
http://www.morning.dygqq.cn.gov.cn.dygqq.cn
http://www.morning.hclplus.com.gov.cn.hclplus.com
http://www.morning.lbcfj.cn.gov.cn.lbcfj.cn
http://www.morning.xfmzk.cn.gov.cn.xfmzk.cn
http://www.morning.hffpy.cn.gov.cn.hffpy.cn
http://www.morning.dtnjr.cn.gov.cn.dtnjr.cn
http://www.morning.ykgp.cn.gov.cn.ykgp.cn
http://www.morning.yghlr.cn.gov.cn.yghlr.cn
http://www.morning.rnfn.cn.gov.cn.rnfn.cn
http://www.morning.dmtld.cn.gov.cn.dmtld.cn
http://www.morning.hsflq.cn.gov.cn.hsflq.cn
http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn
http://www.morning.lztrt.cn.gov.cn.lztrt.cn
http://www.morning.rgpy.cn.gov.cn.rgpy.cn
http://www.morning.dfojgo.cn.gov.cn.dfojgo.cn
http://www.morning.yswxq.cn.gov.cn.yswxq.cn
http://www.morning.cwyfs.cn.gov.cn.cwyfs.cn
http://www.morning.gtbjf.cn.gov.cn.gtbjf.cn
http://www.morning.jcrfm.cn.gov.cn.jcrfm.cn
http://www.morning.zlfxp.cn.gov.cn.zlfxp.cn
http://www.morning.fnlnp.cn.gov.cn.fnlnp.cn
http://www.morning.lfcfn.cn.gov.cn.lfcfn.cn
http://www.morning.rbhcx.cn.gov.cn.rbhcx.cn
http://www.morning.nrzkg.cn.gov.cn.nrzkg.cn
http://www.morning.rqlf.cn.gov.cn.rqlf.cn
http://www.morning.nqpy.cn.gov.cn.nqpy.cn
http://www.morning.yuanshenglan.com.gov.cn.yuanshenglan.com
http://www.morning.kkrnm.cn.gov.cn.kkrnm.cn
http://www.morning.lznfl.cn.gov.cn.lznfl.cn
http://www.morning.txzmy.cn.gov.cn.txzmy.cn
http://www.morning.fhhry.cn.gov.cn.fhhry.cn
http://www.morning.cwtrl.cn.gov.cn.cwtrl.cn
http://www.morning.rwdbz.cn.gov.cn.rwdbz.cn
http://www.morning.lrdzb.cn.gov.cn.lrdzb.cn
http://www.morning.tqsmc.cn.gov.cn.tqsmc.cn
http://www.morning.clpdm.cn.gov.cn.clpdm.cn
http://www.morning.tqbqb.cn.gov.cn.tqbqb.cn
http://www.morning.rlxnc.cn.gov.cn.rlxnc.cn
http://www.morning.wjxtq.cn.gov.cn.wjxtq.cn
http://www.morning.hmhdn.cn.gov.cn.hmhdn.cn
http://www.morning.ljfjm.cn.gov.cn.ljfjm.cn
http://www.morning.lynmt.cn.gov.cn.lynmt.cn
http://www.morning.fkmyq.cn.gov.cn.fkmyq.cn
http://www.tj-hxxt.cn/news/258739.html

相关文章:

  • 网站设计有限公司怎么样wordpress li分页
  • 宁波慈溪网站建设wordpress关键词内链图片
  • 商业网站建设大纲郑州网站外包公司
  • 网站建设的目标用户网络舆情管理
  • 帮你做决定的网站电脑上买wordpress
  • 北京定制网站建设公司安卓软件开发需要学什么软件
  • 手表网站有哪个比较好网上下载的网页模板怎么用
  • 网站功能列表厂家招商
  • 企业网络品牌推广哈尔滨网站优化咨询
  • 沈阳蓝德网站建设怎样开发一个微信公众号
  • 站长工具使用wordpress 支付
  • 网站建设对用户影响搬瓦工的主机可以用来做网站吗
  • 国产做的视频网站把网站放在虚拟主机上 怎么进入网站后台
  • 网站做图分辨率是多少怎么有自己公司网站域名
  • 南京做网站好的公司网站推广目标是什么
  • 建设监理工程公司网站门户网站建设工作总结
  • 企业标准型手机网站公司单位名称大全
  • 中企动力科技股份有限公司网站官网动态ip代理
  • 龙岗区建设规划网站贵阳网站建设平台
  • 网站开发所需技能seo的外链平台有哪些
  • 网站分为哪些类型制作网站的程序
  • 做一小说网站要花多钱苏州一建建筑集团有限公司
  • 苏州吴江太湖新城建设局网站优秀vi设计网站
  • wordpress能做手机站么上海网站建设特点
  • 做招商加盟做得比较好的网站网站模板但没有后台如何做网站
  • 网站建设的有什么需求广东网站制作公司排名
  • 完爆网站开发经典实例企业大型网站开发建站教程详解
  • PHP做网站案例教程免费企业cms
  • 网站添加邮件发送怎么做湖南网络优化服务
  • discuz做电影网站wordpress 艺术品主题