生成excel文件,最简单的莫过于把数据库的数据导入到excel就行了,下面有个不错的示例,大家可以参考下
生成excel 当然使用的是 phpExcel这个类库了,可是它太麻烦了,对于只要简单生成来说有点不值得
什么叫简单,把数据库的数据导入到excel就行了, 这个就是简单了
下面看一段代码(代码来自网络)
注意要双引号的字符串
代码如下:
<?php header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; ?>
运行就会下载test.xls这个文件,打开以后他是这样的

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

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.

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment
