Home >Backend Development >PHP Tutorial >A simple way to generate excel files in php_PHP tutorial

A simple way to generate excel files in php_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:39:34843browse

Of course, the phpExcel class library is used to generate excel, but it is too troublesome and not worth it for simple generation

What is simplicity? Just import the data from the database into excel. This is simplicity.

Look at a piece of code below (the code comes from the Internet)

Pay attention to the double-quoted string

Copy the code Code As follows:

header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls ");
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn" ;
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
?>

When you run it, the file test.xls will be downloaded. After opening, it will look like this
A simple way to generate excel files in php_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/730054.htmlTechArticleGenerate excel. Of course, I use the phpExcel class library, but it is too troublesome. For simple generation, It’s not worth it. What is simplicity? Just import the database data into excel...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn