PHP头条
热点:

php中将数据库的内容导出到excel


把mysql数据库中的内容导出到excel我们只要利用header输出csv格式文档就可以简单实现mysql导出excel文件了,下面我们一起来看个实例.

核心代码就是这里了,代码如下:

header("Content-Type: application/vnd.ms-excel; charset=UTF-8");  
header("Pragma: public");  
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=".$title .".xls ");  
header("Content-Transfer-Encoding: binary ");

以下是用php将数据库导出成excel,测试完全成功,代码如下:


本文地址:

转载随意,但请附上文章地址:-)

www.phpzy.comtrue/php/39423.htmlTechArticlephp中将数据库的内容导出到excel 把mysql数据库中的内容导出到excel我们只要利用header输出csv格式文档就可以简单实现mysql导出excel文件了,下面我们一起来看个实例. 核心代码就是这里了,代...

相关文章

PHP之友评论

今天推荐