跳转到主内容
极星编程网:以代码为星,赴技术山海!

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

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 '
'; echo '' .$title. ''; 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 '' .$zh. ''; echo '' .$xm. ''; echo '' .$sj. ''; echo '' .$bxm. ''; echo '' .$bsj. ''; echo '' .$bz. ''; echo '' .$time. ''; echo ''; // 输出内容 foreach($allRecoms as $key => $outResult) { echo ''; echo '' . $outResult['KHZH'] . ''; echo '' . $outResult['KHXM'] . ''; echo '' . $outResult['SJHM'] . ''; echo '' . $outResult['USERNAME'] . ''; echo '' . $outResult['USERNUMBER'] . ''; echo '' . $outResult['USERNOTE'] . ''; echo '' . $outResult['RECOMTIME'] . ''; echo ''; } echo '';

相关文章