PHPackages                             ank/phpexcel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. ank/phpexcel

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ank/phpexcel
============

3.0.1(5y ago)010MITPHPCI failing

Since Nov 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zhaokeli/ank-phpexcel)[ Packagist](https://packagist.org/packages/ank/phpexcel)[ RSS](/packages/ank-phpexcel/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

ank-phpexcel
============

[](#ank-phpexcel)

导出excel使用方法
-----------

[](#导出excel使用方法)

首先查询出要导出的列表数据

```
//从数据库中查询出数据设置给data;
$conf=[
        'data'     => [
            ['id' => 123, 'title' => '标题'],
        ],
        //下载的文件名字不用加后缀
        'filename' => 'data',
        //定义excel中要使用的数据字段和字段对应的标题
        'field'    =>[
            'id' => '序号',
            'title' => '文章标题',
            '#link#url'=>'http://www.baidu.com',
            '#pic#pic'=>'./1.png'
        ],
    ];

```

> id,title这些字段前面可以添加一些特殊格式的标识 **\#标识#** 来插入对应的特殊数据 如 #pic#id 插入图片 id的值会被识别为图片的路径 #link#url插入链接 url的值为url链接

导入excel数据的方法
------------

[](#导入excel数据的方法)

第一行导入后会默认做为字段，真实的数据是从第二行开始的，第一列数据不能为空，如果遇到第一列为空值则认为Excel内容结束 格式为:

```
title   name    price
标题1   名字1   130
标题2   名字2   140

```

导入后的格式为一个二维数组:

```
array(
array('title'=>"标题1",'name'=>'名字1','price'=>'130'),
array('title'=>"标题2",'name'=>'名字1','price'=>'140'),
)

```

首先建立一个表单

```

```

//使用方法

```
$excel=new \ank\Excel();

//参数一是excel文件路径如果存在则直接解析,参数二是上传的表单name参数一为null的情况下自动从文件域为excel的键读取文件内容
$excel->importExcel('e:/upload/example.xls','excel');

//参数是一个配置项如上面导出的配置一样
$excel->downloadExcel($conf);
//更多用法可以参考example.php中的使用方法

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~94 days

Total

4

Last Release

2097d ago

Major Versions

1.0.0 → 2.0.22020-08-13

2.0.2 → 3.0.02020-08-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/e531cf3f13357c2fc120a3c9335f05a92a88ac517a584dd7f0595865c4c129c7?d=identicon)[735579768](/maintainers/735579768)

---

Top Contributors

[![735579768](https://avatars.githubusercontent.com/u/2497797?v=4)](https://github.com/735579768 "735579768 (11 commits)")[![zhaokeli](https://avatars.githubusercontent.com/u/2497841?v=4)](https://github.com/zhaokeli "zhaokeli (1 commits)")

### Embed Badge

![Health badge](/badges/ank-phpexcel/health.svg)

```
[![Health](https://phpackages.com/badges/ank-phpexcel/health.svg)](https://phpackages.com/packages/ank-phpexcel)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
