header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=11.xls ");
header("Content-Transfer-Encoding: binary ");
?>
Php 代码
代码如下:
0.<?
0.
$filename
="php 导入到 excel-utf-8 编码";
0.
echo
$filename
;
0.?>
访问网站的时候就下载到 excel 里面
要弄单元格区别的话
用 table 表格做网页的就可以了
======================
其他方法 =============================
1
、制作简单 Excel
代码如下:
0.<?php
0.header("Content-type:application/vnd.ms-excel");
0.header("Content-Disposition:filename=php2excel.xls");
0.
0.
echo
"A1/t B1/t C1/n";
0.
echo
"A2/t B2/t C2/n";
0.
echo
"A3/t B3/t C3/n";
0.
echo
"A4/t B4/t C4/n";
0.?>
2
、制作简单 CSV
代码如下:
<?php
$action
=
$_GET
['action'];
if
(
$action
=='make'){
$fp
=
fopen
("demo_csv.csv","a");
//打开 csv 文件,如果不存在则创建