Home  >  Article  >  Backend Development  >  PHP reads Excel and displays the implementation code

PHP reads Excel and displays the implementation code

小云云
小云云Original
2018-02-27 13:30:062266browse

This article mainly shares with you PHP reading Excel and shows the implementation code. I hope it can help everyone.

Use this tool. phpExcelReaderBecause it’s free

Write index.php Introduce the resource file excel_reader2.php .

<?phperror_reporting(E_ALL ^ E_NOTICE);
error_reporting(0);// error_reporting(E_ALL ^ E_NOTICE);require_once &#39;excel_reader2.php&#39;; //加载工具$data = new Spreadsheet_Excel_Reader("example.xls"); //将指定excel文件交给工具进行解析,并把结果赋给$data变量echo $data->dump(true,true);//输出结果,其中dump()函数的两个参数用于指定否需要显示excel文件中原有的行号和列号
 ?>

Because this tool is from ancient times, there will be error prompts when setting it up directly in the php7 environment.
Modificationexcel_reader2.phpThe following places are used to modify and block errors..

  1. Line 98 logout function OLERead() { } This function

  2. puts split( Replace with explode(

  3. ## and block the error option `error_reporting(0);

    ## in index.php

  4. #There are still some warnings after modifying the above. What should I do if
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Spreadsheet_Excel_Reader has a deprecated constructor in D:\xampp\htdocs\pdfreader\excel_reader2.php on line 312Warning: gmdate() expects parameter 2 to be integer, float given in D:\xampp\htdocs\pdfreader\excel_reader2.php on line 79Warning: gmdate() expects parameter 2 to be integer, float given in D:\xampp\htdocs\pdfreader\excel_reader2.php on line 79

is as follows? Easy, come~

error_reporting(0);

Related recommendations:


##Detailed introduction Sample code for PHPExcel to read Excel time

php generates and reads excel files

phpExcel reads excel files

The above is the detailed content of PHP reads Excel and displays the implementation code. For more information, please follow other related articles on the PHP Chinese website!

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