zoukankan      html  css  js  c++  java
  • php 读取excel

    php读取excel,  用phpexcel,

    我是在window环境下开发的,所以匹配php.ini

    zlib.output_compression = On,(从off变成On)

    扩展:

    extension=php_xmlrpc.dll
    extension=php_zip.dll

    这2个要启用

    然后,在此下载 http://phpexcel.codeplex.com/

    //加载类库

    require_once( ROOT_PATH . '/includes/libraries/phpreader/Classes/PHPExcel/IOFactory.php');

    //2007版本的excel文件用 'Excel2007',07以下的版本用Excel5

     // $objReader = PHPExcel_IOFactory::createReader('Excel2007');

      $objReader = PHPExcel_IOFactory::createReader('Excel5');
                $objPHPExcel = $objReader->load('test.xls');

    //读sheet

    foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {

    //读某个sheet的行数据

        foreach ($worksheet->getRowIterator() as $row) {

          //循环读取每个cell的数据

            foreach ($cellIterator as $k => $cell) {
                           if (!is_null($cell) ) {
                        
                             echo $cell->getCalculatedValue()  ."<Br/>"
                         }
                    }

        }

    }





  • 相关阅读:
    meta 标签禁止缩放失效
    [UE4]打包EXE
    [UE4]Set Array Elem
    [UML]用例图
    [UE4]函数参数引用
    阻止移动鼠标双击页面放大, no double tap
    spring boot入门 -- 介绍和第一个例子
    SpringBoot 启动错误搜集
    spring boot 启动找不到或无法加载主类
    Spring Boot中Starter是什么
  • 原文地址:https://www.cnblogs.com/flex_fly/p/2413838.html
Copyright © 2011-2022 走看看