PHP导出excil表格
2015-07-20 08:17
591 查看
PHP导出Excel格式文件(xls),只需给PHP文件加一个文件头,filename 就是导出的xls文件名,当你点击这个文件的URL时,就会提示你下载xls文件了
header("Content-Type: application/vnd.ms-execl");
header("Content-Disposition: attachment; filename=info.xls");
header("Pragma: no-cache");
header("Expires:0");
例子:
<?php
header("Content-Type:
application/vnd.ms-execl");
header("Content-Disposition: attachment;
filename=info.xls");
header("Pragma: no-cache");
header("Expires:0");
require_once(dirname(__FILE__)."/../include/config_base.php");
require_once(dirname(__FILE__)."/../dede/config.php");
require_once(dirname(__FILE__)."/../include/pub_datalist.php");
$dsql
=
new DedeSql(false);
echo "订阅日期"."\t";
echo "订阅内容"."\t";
echo "姓名"."
\t";
$dsql->SetQuery("Select * from `TableName` order by `id`
desc");
$dsql->Execute();
$i = 1;
while($row =
$dsql->GetArray()){
echo $row['uTime']."\t";
echo $row['uCont']."\t";
echo $row['uName']."\t";
$i++;
}?>
2014-04-04
来自于百度空间 迁移
header("Content-Type: application/vnd.ms-execl");
header("Content-Disposition: attachment; filename=info.xls");
header("Pragma: no-cache");
header("Expires:0");
例子:
<?php
header("Content-Type:
application/vnd.ms-execl");
header("Content-Disposition: attachment;
filename=info.xls");
header("Pragma: no-cache");
header("Expires:0");
require_once(dirname(__FILE__)."/../include/config_base.php");
require_once(dirname(__FILE__)."/../dede/config.php");
require_once(dirname(__FILE__)."/../include/pub_datalist.php");
$dsql
=
new DedeSql(false);
echo "订阅日期"."\t";
echo "订阅内容"."\t";
echo "姓名"."
\t";
$dsql->SetQuery("Select * from `TableName` order by `id`
desc");
$dsql->Execute();
$i = 1;
while($row =
$dsql->GetArray()){
echo $row['uTime']."\t";
echo $row['uCont']."\t";
echo $row['uName']."\t";
$i++;
}?>
2014-04-04
来自于百度空间 迁移
相关文章推荐
- PHP 文件系统
- PHPFarm - How to run multiple versions of PHP on the same computer
- 详解PHP错误日志的获取方法
- PHP基于文件存储实现缓存的方法
- php生成过去100年下拉列表的方法
- php数组生成html下拉列表的方法
- php实现编辑和保存文件的方法
- 通过Email发送PHP错误的方法
- yii2.0 GridView 自定按钮操作
- Yii2.0 三级联动实现方法
- Yii2百度编辑器实现方法
- yii2 解决POST数据时因启用Csrf出现的400错误
- yii2.0 灵活使用AssetBundle管理CSS样式及JS脚本
- PHP加密与解密算法
- xml之phpdom操作
- php文件下载步骤
- 闲聊CSDN博客积分前三名------状元:袁萌老爷子;榜眼:phphot;探花:troubleshooter
- php mysqli 查询乱码问题
- php-preg-1
- 2.5. 标准路由器:Zend_Controller_Router_Rewrite