首页 >php教程 >php手册 >php读取excel文件的简单实例

php读取excel文件的简单实例

WBOY
WBOY原创
2016-06-06 20:27:501161浏览

这篇文章介绍了php读取excel文件的简单实例,有需要的朋友可以参考一下

复制代码 代码如下:


     $this->loadexcel();//半酣phpexcel文件
            $_ReadExcel = new PHPExcel_Reader_Excel2007();
            if(!$_ReadExcel->canRead('link.xls')){
            $_ReadExcel = new PHPExcel_Reader_Excel5();
            }
            $_phpExcel = $_ReadExcel->load('link.xls');
            $sheetCount = $_phpExcel->getSheetCount();
            $newExcel = array();
            $excelData = array();

            for($s = 0;$s                $currentSheet = $_phpExcel->getSheet($s);
                $allColumn = $currentSheet->getHighestColumn();
                $allRow = $currentSheet->getHighestRow();
                for($r = 1;$r
                    for($currentColumn='A';$currentColumn                        $address = $currentColumn.$r;
                        $newExcel[] = $currentSheet->getCell($address)->getValue();
                    }
                }
            }


后面就是对数组的操作了--不过要先下载好phpexcel,香港虚拟主机,并包含进来 ,香港服务器,香港空间
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn