#1 mulanhua
最近接到一个朋友的电话,需要将asp程序放到linux下,想到了移植到php,于是谷歌到了SpeedPHP。由于哥自己是做Java开发的,所以项目是基于Netbeans7.0 + Glassfish3 + quercus-4.0.18 开发的。
原asp程序有个功能是导出报名数据到excel,移植到php的话,程序得重写。经过小半天的学习SpeedPHP手册,和谷歌大婶的讨论,还有自己的尝试。总算搞了出来。
之前也到论坛看过,没有类似的代码,提取出来和大家分享。
俺之前几乎没写过php,高手就不要笑话了。
项目工程截图:
main.php
......e2e.html
function e2e() { // 导出报名列表到csv文件
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=中日招生报名表.csv");
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Expires:0');
header('Pragma:public');
$tpl = $this->spArgs("tpl", "skyblue"); // 这里接收tpl参数,使得模板变化
$baoming = spClass("baoming");
$this->results = $baoming->findAll();
$this->display("{$tpl}/e2e.html");
}
......
"中日经济技术学院报名表","","","","","","","","","","","","","","","","","","","","","","","","","" "姓名","性别","年龄","毕业中学","毕业时间","文理科","准考证号","高考时间","高考地点","外语","语文","数学","总分","联系电话","通讯地址","报名时间","身份证","兴趣爱好","父亲姓名","父亲工作单位","母亲姓名","母亲工作单位","报名项目","备注" <{foreach from=$results item=one}> "<{$one.xingming}>","<{$one.xingbie}>","<{$one.nianling}>","<{$one.biyezhongxue}>","<{$one.biyeshijian}>","<{$one.wenlike}>","'<{$one.zhunkaozhenghao}>","<{$one.gaokaoshijian}>","<{$one.gaokaodidian}>","<{$one.waiyu}>","<{$one.yuwen}>","<{$one.shuxue}>","<{$one.zongfen}>","<{$one.lianxidianhua}>","<{$one.tongxundizhi}>","<{$one.baomingshijian}>","'<{$one.shenfenzheng}>","<{$one.xingquaihao}>","<{$one.fuqinxingming}>","<{$one.fuqingongzuodanwei}>","<{$one.muqinxingming}>","<{$one.muqingongzuodanwei}>","<{$one.baomingxiangmu}>","<{$one.beizhu}>" <{/foreach}>
2011-05-31 18:23:56