欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php讀取excel文件的簡單實(shí)例

 更新時(shí)間:2013年08月26日 16:26:53   作者:  
這篇文章介紹了php讀取excel文件的簡單實(shí)例,有需要的朋友可以參考一下

復(fù)制代碼 代碼如下:

     $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<$sheetCount;$s++) {
                $currentSheet = $_phpExcel->getSheet($s);
                $allColumn = $currentSheet->getHighestColumn();
                $allRow = $currentSheet->getHighestRow();
                for($r = 1;$r<=$allRow;$r++){

                    for($currentColumn='A';$currentColumn<=$allColumn;$currentColumn++){
                        $address = $currentColumn.$r;
                        $newExcel[] = $currentSheet->getCell($address)->getValue();
                    }
                }
            }


后面就是對(duì)數(shù)組的操作了--不過要先下載好phpexcel,并包含進(jìn)來

相關(guān)文章

最新評(píng)論