PHP读取Excel并展示实现代码

小云云
小云云 原创
2023-03-20 14:24:02 1747浏览

本文主要和大家分享PHP读取Excel并展示实现代码,希望能帮助到大家。

使用这个工具. phpExcelReader因为免费啊

index.php 引入资源文件 excel_reader2.php .

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

因为这个工具是远古时期的东西,php7环境直接架起来会有错误提示.
修改excel_reader2.php以下几个地方用来修改和屏蔽错误..

  1. 98行注销 function OLERead() { } 这个函数

  2. split( 替换成 explode(

  3. index.php 上面屏蔽错误选项 `error_reporting(0);

修改上面还是有点警告,如下

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

怎么办呢? Easy, 来~

error_reporting(0);

相关推荐:

详细介绍PHPExcel读取Excel时间的示例代码

php生成与读取excel文件

phpExcel读取excel文件

以上就是PHP读取Excel并展示实现代码的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。