分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > IT知识

Phpexcel使用

发布时间:2023-09-06 01:37责任编辑:彭小芳关键词:excel

在看正文之前,友情提示程序员兄弟(姐妹),尽量不要久坐,多起来走动走动咯。有个好身体,才能再干它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 locationin 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.phphttp://example.com/Examples/02types.php...Note: It may be necessary to modify the include/require statements at the beginning ofeach of the test scripts if your "Classes" folder from above is named differently.

使用

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

Phpexcel使用

原文地址:https://www.cnblogs.com/doubilaile/p/8309478.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved