Phpexcel使用

在看正文之前,友情提示程序员兄弟(姐妹),尽量不要久坐,多起来走动走动咯。有个好身体,才能再干它20年嘛!

前言

之前在处理表格相关的需求时,写表格我用的table的方式,读的话我是先将excel文件转换成csv,然后根据行和“,”分隔符进行内容读取。但是这样不是很灵活,遇到一些特殊字符,像换行什么的,还容易出问题,所以今天就简单地学习了一下phpexcel。

学习方法

phpexcel的学习建议大家主要看这里:https://github.com/PHPOffice/PHPExcel ,然后再结合网上一些资料。

安装

安装方法在github的项目说明里有:

install.txt的内容是:

Requirements
------------

The following requirements should be met prior to using PHPExcel:
* PHP version 5.2.0 or higher
* PHP extension php_zip enabled *)
* PHP extension php_xml enabled
* PHP extension php_gd2 enabled (if not compiled in)

*) php_zip is only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007,
   PHPExcel_Reader_OOCalc. In other words, if you need PHPExcel to handle .xlsx or .ods
   files you will need the zip extension, but otherwise not.



Installation instructions
-------------------------

Installation is quite easy: copy the contents of the Classes folder to any location
in your application required.

Example:

If your web root folder is /var/www/ you may want to create a subfolder called
/var/www/Classes/ and copy the files into that folder so you end up with files:

/var/www/Classes/PHPExcel.php
/var/www/Classes/PHPExcel/Calculation.php
/var/www/Classes/PHPExcel/Cell.php
...



Getting started
---------------

A good way to get started is to run some of the tests included in the download.
Copy the "Examples" folder next to your "Classes" folder from above so you end up with:

/var/www/Examples/01simple.php
/var/www/Examples/02types.php
...

Start running the test by pointing your browser to the test scripts:

http://example.com/Examples/01simple.php
http://example.com/Examples/02types.php
...

Note: It may be necessary to modify the include/require statements at the beginning of
each of the test scripts if your "Classes" folder from above is named differently.

使用

写可以参考这个文件。读可以参考这个文件。

 

转载于:https://www.cnblogs.com/doubilaile/p/8309478.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值