search
Homephp教程php手册php Spreadsheet_Excel_Reader读取excel文件

本文章主要是讲利用spreadsheet_excel_reader读取 excel文件,在你网站数据量超大的时候或有很多会员数据时这个是有必要把当日数据导入到excel备份的,为此我们提供一款读取excel文件实例.

使用本实例需要先下载一个spreadsheet_excel_reader类.

PHP实例代码如下:

$reader=new spreadsheet_excel_reader(); 
$reader->setutfencoder('iconv'); 
$reader->setoutputencoding('utf-8'); //可以设置的文档编码 
$reader->read($filename); 
//如果以以表格形式输出我们就利用遍历 
foreach ($reader->boundsheets as $k=>$sheet) 
{ 
    echo "n$k: $sheet"; 
} 
//表中的数据存储在表变量.每一个表是一个二维数组。以下是如何打印所有数据 
foreach($reader->sheets as $k=>$data) 
{
    echo "nn ".$reader->boundsheets[$k]."nn"; 
    foreach($data['cells'] as $row) 
    { 
        foreach($row as $cell) 
        { 
            echo "$cellt"; 
        } 
        echo "n"; 
    } 
}


本文地址:

转载随意,但请附上文章地址:-)

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft