Yii中使用PHPExcel导出Excel实例代码
文章来给大家介绍在yii框架中利用PHPExcel插件来快速实例导出excel数据的具体方法,有在使用yii的同学不防进入参考一下.
最近在研究PHP的Yii框架,很喜欢,碰到导出Excel的问题,研究了一下,就有了下面的方法.
1、首先在cofig/main.php中添加对PHPExcel的引用,我的方法是这样,代码如下:
1 2 3 4 5 6 7 |
|
2、当然要记得将PHPExcel整个目录复制到项目的 "protected/extensions/" 目录下面.
3、按照下面的代码修改PHPExcel代码目录里的Autoloader.php文件,代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
上面的函数中,注释掉的是原有的代码.
4、下面的代码是输出Excel,以及一些常用的属性设置,在你的Controller中,代码如下:
1 2 3 4 5 6 7 8 |
|
文章网址:
随意转载^^但请附上教程地址。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics









