Zend Framework 数据集 excel 导出解决思路

WBOY
Release: 2016-06-13 13:39:12
Original
1052 people have browsed it

Zend Framework 数据集 excel 导出
小弟想把从数据库(mysql) 读取的数据集 excel格式导出
 
  用的框架是ZF 小弟是新手 求高手指导 谢谢你们!

------解决方案--------------------
class downloadController extends Controlloer{
function init(){}

function download(){
//查数据库代码取结果集
//结果写入文件aa.cvs
//header("");下载

}
}

页面中 导出

大致就是这样。当然还有其他方法。 

}
------解决方案--------------------
http://apps.hi.baidu.com/share/detail/35261920
------解决方案--------------------

PHP code

 header("Content-Type: application/vnd.ms-excel");
        header("Content-Disposition: attachment; filename=test.xls");
        header("Pragma: no-cache");
        header("Expires: 0");
        $title = mb_convert_encoding('推荐信息','GB2312','utf-8');
        echo '
Copy after login
'; echo ''; echo ''; if($recomType == 'customer') { // 输出字段名 $zh = mb_convert_encoding('推荐人账号','GB2312','utf-8'); $xm = mb_convert_encoding('推荐人姓名','GB2312','utf-8'); $sj = mb_convert_encoding('推荐人手机号','GB2312','utf-8'); $bxm = mb_convert_encoding('被推荐人姓名','GB2312','utf-8'); $bsj = mb_convert_encoding('被推荐人手机号','GB2312','utf-8'); $bz = mb_convert_encoding('备注说明','GB2312','utf-8'); $time = mb_convert_encoding('推荐时间','GB2312','utf-8'); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; // 输出内容 foreach($allRecoms as $key => $outResult) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
' .$title. '
' .$zh. '' .$xm. '' .$sj. '' .$bxm. '' .$bsj. '' .$bz. '' .$time. '
 ' . $outResult['KHZH'] . '' . $outResult['KHXM'] . '' . $outResult['SJHM'] . '' . $outResult['USERNAME'] . '' . $outResult['USERNUMBER'] . '' . $outResult['USERNOTE'] . '' . $outResult['RECOMTIME'] . '
';
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!