利用php导出excel我们大多会直接生成 csv文件,这种方便快捷如果不是要求很高,完全可以利用csv 来实例了,
这是最简单的了
代码如下 | 复制代码 |
header("Content-type:application/vnd.ms-excel"); $tx=’表头’; |
如果你一定要输入xls标准的excel文件可参考下面方法
/**
* 输出XLS的头信息
* 注:使用此函数前后都不应有任何数据输出
* @param $data Array 下载的数据
* @param $file_name String 下载的文件名
*/
代码如下 | 复制代码 | |
function outputXlsHeader($data,$file_name = 'export')
echo $table_data; die(); }
|
下面还推荐一下第三方的做法
引用google code中推荐的小类库(大体同方法一,比较复杂点)
http://code.google.com/p/php-excel/downloads/list
PHPEXCEL 类库,功能强大,支持win Excel2003 ,Win Excel2007

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment