当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Cell::columnIndexfromString方法代码示例

本文整理汇总了PHP中PHPExcel_Cell::columnIndexfromString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Cell::columnIndexfromString方法的具体用法?PHP PHPExcel_Cell::columnIndexfromString怎么用?PHP PHPExcel_Cell::columnIndexfromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Cell的用法示例。


在下文中一共展示了PHPExcel_Cell::columnIndexfromString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doWebImportingsave

 public function doWebImportingsave()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     $districtid = intval($_GPC['districtid']);
     if (!$rid) {
         message('系统出错', url('site/entry/branch', array('rid' => $rid, 'm' => 'stonefish_bigwheel')), 'error');
         exit;
     }
     if (empty($_FILES["inputExcel"]["tmp_name"])) {
         message('系统出错', url('site/entry/branch', array('rid' => $rid, 'm' => 'stonefish_bigwheel')), 'error');
         exit;
     }
     $inputFileName = '../addons/stonefish_bigwheel/template/moban/excel/' . $_FILES["inputExcel"]["name"];
     if (file_exists($inputFileName)) {
         unlink($inputFileName);
         //如果服务器上存在同名文件,则删除
     }
     move_uploaded_file($_FILES["inputExcel"]["tmp_name"], $inputFileName);
     require_once '../framework/library/phpexcel/PHPExcel.php';
     require_once '../framework/library/phpexcel/PHPExcel/IOFactory.php';
     require_once '../framework/library/phpexcel/PHPExcel/Reader/Excel5.php';
     //设置php服务器可用内存,上传较大文件时可能会用到
     ini_set('memory_limit', '1024M');
     $objReader = PHPExcel_IOFactory::createReader('Excel5');
     //use excel2007 for 2007 format
     $objPHPExcel = $objReader->load($inputFileName);
     $sheet = $objPHPExcel->getSheet(0);
     $highestRow = $sheet->getHighestRow();
     //取得总行数
     $highestColumn = $sheet->getHighestColumn();
     //取得总列数
     $objWorksheet = $objPHPExcel->getActiveSheet();
     $highestRow = $objWorksheet->getHighestRow();
     $highestColumn = $objWorksheet->getHighestColumn();
     $highestColumnIndex = PHPExcel_Cell::columnIndexfromString($highestColumn);
     //总列数
     $headtitle = array();
     for ($row = 2; $row <= $highestRow; $row++) {
         $strs = array();
         //注意highestColumnIndex的列数索引从0开始
         for ($col = 0; $col < $highestColumnIndex; $col++) {
             $strs[$col] = $objWorksheet->getCellByColumnandRow($col, $row)->getValue();
         }
         //查询是否规定了区域商点
         if (!empty($districtid)) {
             $strs[2] = $districtid;
         }
         //查询是否规定了区域商点
         //插入数据
         $chongfu = pdo_fetch("select id from " . tablename('stonefish_branch_doings') . " where mobile =:mobile and uniacid=:uniacid and districtid=:districtid", array(':mobile' => $strs[0], ':uniacid' => $_W['uniacid'], ':districtid' => $strs[2]));
         $data = array('uniacid' => $_W['uniacid'], 'rid' => $rid, 'module' => 'stonefish_bigwheel', 'mobile' => $strs[0], 'awardcount' => $strs[1], 'districtid' => $strs[2], 'status' => 2, 'createtime' => time());
         if (!empty($chongfu)) {
             pdo_update('stonefish_branch_doings', $data, array('id' => $chongfu['id']));
         } else {
             pdo_insert('stonefish_branch_doings', $data);
         }
     }
     unlink($inputFileName);
     //删除上传的excel文件
     message('导入抽奖次数成功', url('site/entry/branch', array('rid' => $rid, 'm' => 'stonefish_bigwheel')));
     exit;
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:63,代码来源:site.php


注:本文中的PHPExcel_Cell::columnIndexfromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。