Home  >  Article  >  Backend Development  >  php Excel Reader是什么?

php Excel Reader是什么?

PHPz
PHPzOriginal
2016-06-13 12:04:571593browse

PHP Excel Reader是一个用来读取EXCEL表格文件的PHP类,能够获取EXCEL文件中任意单元格的值和格式。

php Excel Reader是什么?

PHP Excel Reader 是一个用来读取 EXCEL 表格文件的 PHP 类,能够获取EXCEL文件(.xls)中任意单元格的值和格式。

下载PHP Excel Reader

下载地址:http://sourceforge.net/projects/phpexcelreader/

使用示例:

表格对应内容:

1.png

引入类,创建对象,设置读取文件的目录

<?php 
error_reporting(E_ALL ^ E_NOTICE);
require_once &#39;excel_reader2.php&#39;;
$data = new Spreadsheet_Excel_Reader();//创建对象
$data->setOutputEncoding(&#39;UTF-8&#39;);//设置编码格式
$data->read("example.xls");//读取excel文档

读取完毕后,会将表格有关的信息,全部存到一个大数组中。

<?php
error_reporting(E_ALL ^ E_NOTICE);
require_once &#39;excel_reader2.php&#39;;
$data = new Spreadsheet_Excel_Reader();//创建对象
$data->setOutputEncoding(&#39;UTF-8&#39;);//设置编码格式
$data->read("example.xls");//读取excel文档
echo "<pre class="brush:php;toolbar:false">";
print_r($data->sheets);
echo "
";

运行结果如下

2.png

更多相关知识,请访问 PHP中文网!!

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