国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php讀取excel文件的簡單實例

2024-05-04 23:12:44
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:


     $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();
                    }
                }
            }


后面就是對數組的操作了--不過要先下載好phpexcel,并包含進來

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 德清县| 龙南县| 贺州市| 沅江市| 许昌市| 嘉禾县| 洪江市| 麻江县| 荣成市| 廊坊市| 尼玛县| 上林县| 吐鲁番市| 木里| 革吉县| 桃源县| 清涧县| 微山县| 清水河县| 萝北县| 镶黄旗| 六盘水市| 景德镇市| 巴楚县| 阜南县| 托里县| 南澳县| 金沙县| 错那县| 聂拉木县| 西畴县| 兴仁县| 和平县| 楚雄市| 乐安县| 红桥区| 淅川县| 平远县| 罗山县| 沾化县| 曲麻莱县|